perf: Optimize array_to_string(), support more types#20553
perf: Optimize array_to_string(), support more types#20553neilconway wants to merge 10 commits intoapache:mainfrom
array_to_string(), support more types#20553Conversation
|
Note to reviewers: it might be easier to just read the new code, rather than deciphering the diff. I had to rewrite most of the existing logic. Also, this PR includes the commit from #20536 to avoid merge conflicts down the road. |
|
Benchmarks: |
|
Updated benchmarks; I added special-cases for integers and floats, and also added a benchmark for floats: |
|
I think adding dependencies on |
|
So it turns out that when using For the time being, I've reverted the change to use Updated benchmark numbers: |
array_to_string(), support decimal arraysarray_to_string(), support more types
Which issue does this PR close?
array_to_stringto avoid unnecessary allocations #20551.array_to_string()does not support decimal arrays #20552.Rationale for this change
array_to_stringdid a lot of unnecessary allocations. Rewriting the function to avoid those allocations yields around a 50-75% performance improvement.What changes are included in this PR?
array_to_stringStringbuffer across rows viabuf.clear(), instead of allocating freshx.to_string()+push_stritoacrate, but it yields significant speedups over a genericwrite!approachdecimaland all the datetime typesAre these changes tested?
Yes, and benchmarked.
Are there any user-facing changes?
No.