Repository navigation
perf(parquet-variant): Avoid intermediate string allocations in JSON serialization - #11402
Conversation
Co-authored-by: Jeffrey Vo <[email protected]>
Jefffrey
left a comment
There was a problem hiding this comment.
functionally looks good, should be good to go once we can get some numbers per above comment
# Which issue does this PR close? - Part of apache#10906 - Supports benchmarking apache#11402 # Rationale for this change `variant_kernels.rs` benchmarks `json_to_variant` and `variant_get`, but has no coverage for `variant_to_json`. Add benchmarks to track serialization performance and evaluate changes such as avoiding temporary string allocations in apache#11402. # What changes are included in this PR? Add seven `variant_to_json` benchmarks, each processing 8,192 rows: - Integer scalars and the same values in shredded form. - Small objects containing two strings and an integer. - The same small objects with dictionary and run-end-encoded metadata. - Wide objects using the existing seeded generator with 200 entries per object and mixed scalar values. - Numeric lists with 0–100 elements. Reuse existing fixture generators and the shared row-count constant. Fixture construction and metadata encoding happen outside the timed loops. # Are these changes tested? All seven cases passed a smoke run and completed a release-mode Criterion run with 100 samples each. Compilation, formatting, and spelling checks pass. Clippy with the installed stable toolchain encounters existing lint errors in `arrow-data`. # Are there any significant user-facing changes? No. AI assistance: OpenAI Codex helped implement and refine the benchmarks, run local validation, and draft this description.
|
run benchmark variant_kernels |
|
🤖 Benchmark starting (GKE) | trigger Target: variant_kernels Sharding factor: 1 (1 workers). Comparing string_alloc_11396 (d87f45b) to a9b8d27 (merge-base) diff Run configurationrun benchmark variant_kernels
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: variant_kernels Comparing string_alloc_11396 (d87f45b) to a9b8d27 (merge-base) diff Run configurationrun benchmark variant_kernels
shards: 1
DetailsPer-runner informationvariant_kernels — shard 1/1Node: gk3-benchmark-cluster-nap-2hx8ema4-917ada51-b8mp Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench variant_kernelsCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
run benchmark variant_kernels |
|
🤖 Benchmark starting (GKE) | trigger Target: variant_kernels Sharding factor: 1 (1 workers). Comparing string_alloc_11396 (00c5a4c) to a2c6898 (merge-base) diff Run configurationrun benchmark variant_kernels
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: variant_kernels Comparing string_alloc_11396 (00c5a4c) to a2c6898 (merge-base) diff Run configurationrun benchmark variant_kernels
shards: 1
DetailsPer-runner informationvariant_kernels — shard 1/1Node: gk3-benchmark-cluster-nap-1owxhrut-c0a84958-tx7c Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench variant_kernelsCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
thanks @rizzabhdwaj @Jefffrey @sdf-jkl |
Which issue does this PR close?
Rationale for this change
Avoid unnecessary temporary
Stringallocations when serializing JSON values by writing directly to the output buffer.What changes are included in this PR?
serde_json::to_writerfor direct JSON serialization.Stringallocations and copies.