You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "cakeni (via GitHub)" <gi...@apache.org> on 2026/08/11 10:56:09 UTC

[PR] Replace BufferBuilder with Vec in MapArrayDecoder [arrow-rs]

cakeni opened a new pull request, #10629:
URL: https://github.com/apache/arrow-rs/pull/10629

   # Which issue does this PR close?
   
   - Part of #10245.
   
   # Rationale for this change
   
   Using `Vec` instead of `BufferBuilder` can improve performance by benefiting from Rust's optimized `Vec` implementation. This updates the remaining `BufferBuilder` usage in `arrow-json` and follows the existing `ListArrayDecoder` approach.
   
   # What changes are included in this PR?
   
   - Replace `MapArrayDecoder`'s offset `BufferBuilder<i32>` with a preallocated `Vec<i32>`.
   - Construct the final `ScalarBuffer` directly from the vector.
   - Remove the now-unused `BufferBuilder` import.
   
   # Are these changes tested?
   
   Yes. The following checks pass:
   
   - `cargo +stable-x86_64-pc-windows-gnu fmt --all -- --check`
   - `cargo +stable-x86_64-pc-windows-gnu clippy -p arrow-json --all-targets --all-features --no-deps -- -D warnings`
   - `cargo +stable-x86_64-pc-windows-gnu test -p arrow-json --all-features` (134 unit tests and 17 doctests passed)
   
   # Are there any user-facing changes?
   
   No.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Replace BufferBuilder with Vec in MapArrayDecoder [arrow-rs]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10629:
URL: https://github.com/apache/arrow-rs/pull/10629#issuecomment-5264127424

   🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10629#issuecomment-5263922631)
   
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
   
   Comparing perf/arrow-json-map-offsets-vec (4006e1462326d781c0a490218b32c74a5aae599c) to fc16607 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/fc16607ccfdb298557ed6630742941761ac18ce3..4006e1462326d781c0a490218b32c74a5aae599c)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark json_reader
   ```
   
   </details>
   
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   <details><summary>Details</summary>
   <p>
   
   ```
   group                                        main                                   perf_arrow-json-map-offsets-vec
   -----                                        ----                                   -------------------------------
   decode_binary_hex_json                       1.00     13.8±0.04ms        ? ?/sec    1.00     13.7±0.05ms        ? ?/sec
   decode_binary_view_hex_json                  1.00     14.2±0.06ms        ? ?/sec    1.00     14.2±0.04ms        ? ?/sec
   decode_fixed_binary_hex_json                 1.00     13.8±0.04ms        ? ?/sec    1.02     14.1±0.10ms        ? ?/sec
   decode_list_long_json/131072                 1.00    303.8±1.45ms   257.8 MB/sec    1.01    308.2±1.33ms   254.1 MB/sec
   decode_list_long_serialize                   1.00    206.2±1.09ms        ? ?/sec    1.00    206.6±1.68ms        ? ?/sec
   decode_list_short_json/131072                1.00     19.7±0.09ms   264.6 MB/sec    1.01     20.0±0.07ms   261.2 MB/sec
   decode_list_short_serialize                  1.01     11.8±0.09ms        ? ?/sec    1.00     11.6±0.12ms        ? ?/sec
   decode_list_view_long_json/131072            1.00    304.4±1.92ms   257.2 MB/sec    1.01    308.4±1.25ms   253.9 MB/sec
   decode_list_view_long_serialize              1.00    207.2±1.07ms        ? ?/sec    1.00    207.8±1.33ms        ? ?/sec
   decode_list_view_short_json/131072           1.00     20.7±0.06ms   252.5 MB/sec    1.00     20.6±0.06ms   253.4 MB/sec
   decode_list_view_short_serialize             1.00     12.0±0.11ms        ? ?/sec    1.00     12.0±0.12ms        ? ?/sec
   decode_map_large_json/131072                 1.00    254.8±1.06ms   298.1 MB/sec    1.00    255.7±1.05ms   297.1 MB/sec
   decode_map_large_serialize                   1.00    288.4±2.08ms        ? ?/sec    1.02    293.5±1.75ms        ? ?/sec
   decode_map_small_json/131072                 1.00     29.5±0.13ms   278.6 MB/sec    1.01     29.8±0.12ms   276.2 MB/sec
   decode_map_small_serialize                   1.00     20.2±0.17ms        ? ?/sec    1.01     20.4±0.16ms        ? ?/sec
   decode_ree_long_json/131072                  1.00      5.9±0.01ms   258.9 MB/sec    1.01      5.9±0.01ms   256.6 MB/sec
   decode_ree_long_serialize                    1.01      4.4±0.05ms        ? ?/sec    1.00      4.4±0.07ms        ? ?/sec
   decode_ree_short_json/131072                 1.05      6.8±0.02ms   254.7 MB/sec    1.00      6.5±0.01ms   266.8 MB/sec
   decode_ree_short_serialize                   1.03      4.8±0.08ms        ? ?/sec    1.00      4.7±0.05ms        ? ?/sec
   decode_wide_object_json/131072               1.00    459.6±6.89ms   209.4 MB/sec    1.00    457.6±2.80ms   210.3 MB/sec
   decode_wide_object_serialize                 1.01    440.7±6.38ms        ? ?/sec    1.00    436.0±3.41ms        ? ?/sec
   decode_wide_projection_full_json/131072      1.00    765.1±9.52ms   227.4 MB/sec    1.01    774.3±6.01ms   224.7 MB/sec
   decode_wide_projection_narrow_json/131072    1.00    434.9±1.59ms   400.1 MB/sec    1.00    433.5±1.44ms   401.4 MB/sec
   infer_json_schema/1000                       1.00  1521.2±20.56µs    83.0 MB/sec    1.00  1525.3±17.81µs    82.8 MB/sec
   large_bench_primitive                        1.00   1496.7±2.01µs        ? ?/sec    1.01   1507.7±3.57µs        ? ?/sec
   small_bench_list                             1.00      6.8±0.02µs        ? ?/sec    1.00      6.8±0.03µs        ? ?/sec
   small_bench_primitive                        1.00      3.9±0.02µs        ? ?/sec    1.01      4.0±0.07µs        ? ?/sec
   small_bench_primitive_with_utf8view          1.00      4.0±0.01µs        ? ?/sec    1.00      3.9±0.02µs        ? ?/sec
   ```
   
   </p>
   </details>
   
   <details><summary>Resource Usage</summary>
   
   **base (merge-base)**
   | Metric | Value |
   |--------|-------|
   | Wall time | 450.1s |
   | Peak memory | 1.4 GiB |
   | Avg memory | 923.4 MiB |
   | CPU user | 406.7s |
   | CPU sys | 37.6s |
   | Peak spill | 0 B |
   
   **branch**
   | Metric | Value |
   |--------|-------|
   | Wall time | 450.1s |
   | Peak memory | 1.4 GiB |
   | Avg memory | 927.3 MiB |
   | CPU user | 407.6s |
   | CPU sys | 37.8s |
   | Peak spill | 0 B |
   </details>
   
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Replace BufferBuilder with Vec in MapArrayDecoder [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #10629:
URL: https://github.com/apache/arrow-rs/pull/10629


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Replace BufferBuilder with Vec in MapArrayDecoder [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10629:
URL: https://github.com/apache/arrow-rs/pull/10629#issuecomment-5263922631

   run benchmark json_reader


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Replace BufferBuilder with Vec in MapArrayDecoder [arrow-rs]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10629:
URL: https://github.com/apache/arrow-rs/pull/10629#issuecomment-5263952276

   🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10629#issuecomment-5263922631)
   **Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c5263922631-1556-tmcff 6.12.85+ #1 SMP Wed Jun 17 20:31:55 UTC 2026 aarch64 GNU/Linux`
   <details><summary>CPU Details (lscpu)</summary>
   
   ```
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   Comparing perf/arrow-json-map-offsets-vec (4006e1462326d781c0a490218b32c74a5aae599c) to fc16607 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/fc16607ccfdb298557ed6630742941761ac18ce3..4006e1462326d781c0a490218b32c74a5aae599c)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark json_reader
   ```
   
   </details>
   
   BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench json_reader
   Results will be posted here when complete
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org