Skip to content

perf: Write compressed directly to buffer - #10833

Merged
alamb merged 3 commits into
apache:mainfrom
EmilyMatt:compress_directly
Aug 26, 2026
Merged

perf: Write compressed directly to buffer#10833
alamb merged 3 commits into
apache:mainfrom
EmilyMatt:compress_directly

Conversation

@EmilyMatt

Copy link
Copy Markdown
Contributor

Currently we have to allocate twice when compressing using zstd - once to a temporary vec, which is the output from the compress(input) call, and then extend our output buffer with extend_from_slice which causes another realloc(especially if writing a large buffer)
instead we can use the zstd compress_to_buffer function directly, which is what the compress() call does anyway.

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-ipc labels Aug 25, 2026
@Rich-T-kid

Copy link
Copy Markdown
Contributor

run benchmarks arrow_ipc

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5411365772-1940-zt6zl 6.12.85+ #1 SMP Sat Jun 27 09:31:30 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
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

Comparing compress_directly (32bfb62) to 7d9bdfd (merge-base) diff

Run configuration
run benchmark arrow_ipc

BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_ipc
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

Benchmark for this request failed before finishing (Kubernetes reason: BackoffLimitExceeded).

Benchmarks requested: arrow_ipc

Kubernetes message
Job has reached the specified backoff limit

File an issue against this benchmark runner

@alamb

alamb commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

run benchmarks ipc_writer

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5416607315-1957-nlkql 6.12.85+ #1 SMP Sat Jun 27 09:31:30 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
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

Comparing compress_directly (32bfb62) to 7d9bdfd (merge-base) diff

Run configuration
run benchmark ipc_writer

BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer
Results will be posted here when complete


File an issue against this benchmark runner

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me -- thank you @EmilyMatt and @Rich-T-kid

Even if the benchmarks don't show a measurable win as long as they don't slow down I think this PR is a win

let result = context.zstd_compressor(level).compress(input)?;
output.extend_from_slice(&result);
let start = output.len();
output.reserve(zstd::zstd_safe::compress_bound(input.len()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internally compress() also calls compress_bound for the allocation size

https://docs.rs/zstd/0.13.3/src/zstd/bulk/compressor.rs.html#132

So I think this is no worse (and better as it avoids a copy)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I just took it from the function itself as it seems to do all those steps except into a new Vec

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

Comparing compress_directly (32bfb62) to 7d9bdfd (merge-base) diff

Run configuration
run benchmark ipc_writer
CPU Details (lscpu)
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

group                                                         compress_directly                      main
-----                                                         -----------------                      ----
arrow_ipc_stream_writer/FileWriter/write_10                   1.01     89.7±0.42µs        ? ?/sec    1.00     88.8±0.33µs        ? ?/sec
arrow_ipc_stream_writer/FileWriter/write_10/dict/delta        1.04    152.5±2.89µs        ? ?/sec    1.00    146.3±2.69µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10               1.00     22.9±0.33µs        ? ?/sec    1.00     23.0±0.23µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.13     61.4±5.89µs        ? ?/sec    1.00     54.2±0.50µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict/delta    1.08    137.0±3.25µs        ? ?/sec    1.00    127.3±1.70µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/zstd          1.01      7.3±0.03ms        ? ?/sec    1.00      7.2±0.03ms        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10                 1.01     86.9±0.56µs        ? ?/sec    1.00     85.8±0.57µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/dict            1.08     80.6±9.20µs        ? ?/sec    1.00     74.7±0.56µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/dict/delta      1.06    150.3±4.23µs        ? ?/sec    1.00    142.0±2.39µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/zstd            1.01      7.3±0.03ms        ? ?/sec    1.00      7.2±0.03ms        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 105.0s
Peak memory 12.3 MiB
Avg memory 10.4 MiB
CPU user 100.9s
CPU sys 0.0s
Peak spill 0 B

branch

Metric Value
Wall time 105.0s
Peak memory 12.3 MiB
Avg memory 10.7 MiB
CPU user 102.1s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.13     61.4±5.89µs        ? ?/sec    1.00     54.2±0.50µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict/delta    1.08    137.0±3.25µs        ? ?/sec    1.00    127.3±1.70µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/dict            1.08     80.6±9.20µs        ? ?/sec    1.00     74.7±0.56µs        ? ?/sec

are the dictionary benchmarks noisy or is this causing a real regression in the dictionary case 🤔

@Rich-T-kid

Copy link
Copy Markdown
Contributor

run benchmarks ipc_writer

1 similar comment
@Rich-T-kid

Copy link
Copy Markdown
Contributor

run benchmarks ipc_writer

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5419667393-1958-c5ngz 6.12.85+ #1 SMP Sat Jun 27 09:31:30 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
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

Comparing compress_directly (f90306f) to 2a82e59 (merge-base) diff

Run configuration
run benchmark ipc_writer

BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5419668673-1959-wbn27 6.12.85+ #1 SMP Sat Jun 27 09:31:30 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
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

Comparing compress_directly (f90306f) to 2a82e59 (merge-base) diff

Run configuration
run benchmark ipc_writer

BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

Comparing compress_directly (f90306f) to 2a82e59 (merge-base) diff

Run configuration
run benchmark ipc_writer
CPU Details (lscpu)
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

group                                                         compress_directly                      main
-----                                                         -----------------                      ----
arrow_ipc_stream_writer/FileWriter/write_10                   1.00     88.5±0.25µs        ? ?/sec    1.01     89.7±0.44µs        ? ?/sec
arrow_ipc_stream_writer/FileWriter/write_10/dict/delta        1.00    147.8±3.73µs        ? ?/sec    1.04    154.0±3.05µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10               1.00     22.9±0.31µs        ? ?/sec    1.02     23.4±0.44µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.19     66.4±0.47µs        ? ?/sec    1.00     55.8±0.37µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict/delta    1.00    132.5±3.51µs        ? ?/sec    1.01    133.5±3.33µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/zstd          1.00      7.2±0.03ms        ? ?/sec    1.01      7.3±0.09ms        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10                 1.00     86.0±0.58µs        ? ?/sec    1.03     88.4±0.44µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/dict            1.00     71.7±0.43µs        ? ?/sec    1.08     77.2±0.46µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/dict/delta      1.00    143.9±3.41µs        ? ?/sec    1.03    148.5±3.09µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/zstd            1.00      7.2±0.03ms        ? ?/sec    1.01      7.3±0.03ms        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 105.0s
Peak memory 11.4 MiB
Avg memory 10.4 MiB
CPU user 101.9s
CPU sys 0.0s
Peak spill 0 B

branch

Metric Value
Wall time 110.0s
Peak memory 12.7 MiB
Avg memory 10.4 MiB
CPU user 104.1s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

Comparing compress_directly (f90306f) to 2a82e59 (merge-base) diff

Run configuration
run benchmark ipc_writer
CPU Details (lscpu)
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

group                                                         compress_directly                      main
-----                                                         -----------------                      ----
arrow_ipc_stream_writer/FileWriter/write_10                   1.00     89.0±0.36µs        ? ?/sec    1.02     90.6±0.55µs        ? ?/sec
arrow_ipc_stream_writer/FileWriter/write_10/dict/delta        1.02    154.4±6.75µs        ? ?/sec    1.00    151.6±5.64µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10               1.00     22.7±0.30µs        ? ?/sec    1.01     23.0±0.21µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.22     67.1±0.77µs        ? ?/sec    1.00     55.0±0.42µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict/delta    1.00    126.6±2.00µs        ? ?/sec    1.06    133.8±3.61µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/zstd          1.00      7.2±0.04ms        ? ?/sec    1.01      7.3±0.03ms        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10                 1.00     87.2±0.68µs        ? ?/sec    1.03     89.8±0.63µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/dict            1.00     72.4±0.20µs        ? ?/sec    1.06     76.6±0.54µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/dict/delta      1.02    146.8±5.15µs        ? ?/sec    1.00    144.3±3.28µs        ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/zstd            1.00      7.2±0.04ms        ? ?/sec    1.00      7.2±0.03ms        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 105.0s
Peak memory 12.2 MiB
Avg memory 10.7 MiB
CPU user 102.9s
CPU sys 0.0s
Peak spill 0 B

branch

Metric Value
Wall time 110.0s
Peak memory 11.8 MiB
Avg memory 10.2 MiB
CPU user 104.1s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.19     66.4±0.47µs        ? ?/sec    1.00     55.8±0.37µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.22     67.1±0.77µs        ? ?/sec    1.00     55.0±0.42µs        ? ?/sec

the benchmark its self looks fine so i dont think this is noise -

group.bench_function("StreamEncoder/encode_10/dict", |b| {

@EmilyMatt

Copy link
Copy Markdown
Contributor Author
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.19     66.4±0.47µs        ? ?/sec    1.00     55.8±0.37µs        ? ?/sec
arrow_ipc_stream_writer/StreamEncoder/encode_10/dict          1.22     67.1±0.77µs        ? ?/sec    1.00     55.0±0.42µs        ? ?/sec

the benchmark its self looks fine so i dont think this is noise -

group.bench_function("StreamEncoder/encode_10/dict", |b| {

I can't seem to reproduce anything conclusive locally

StreamWriter/write_10/zstd

variant mean median min max sd paired Δ vs main (95% CI) wins
main 4.8460 4.8189 4.7925 4.9493 0.0626
reserve 4.7904 4.7872 4.7435 4.8635 0.0416 −1.13% [−2.63, +0.36] 5/6
reserve_exact 4.7692 4.7660 4.7539 4.7946 0.0165 −1.57% [−2.98, −0.16] 6/6

StreamEncoder/encode_10/zstd

variant mean median min max sd paired Δ vs main (95% CI) wins
main 4.7536 4.7498 4.7248 4.7888 0.0238
reserve 4.8166 4.7561 4.6901 5.1938 0.1886 +1.33% [−2.99, +5.65] 3/6
reserve_exact 4.7793 4.7699 4.6992 4.9262 0.0799 +0.54% [−1.21, +2.29] 3/6

(I thought maybe the issue is that the benchmark oes a single encode which would be better with reserve_exact as that might save a reallocation in some specific cases, but even if that proves better for those cases, it's irrelevant for real life use, since after the encode() call there will be others, meaning the vec would be reallocated anyway after the reserve_exact, making it worse, rather than better)

@alamb

alamb commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

I can't seem to reproduce anything conclusive locally

Yeah I agree this benchmark seems to be overly sensitve to allocation patterns. Let's just merge this on its merits

@alamb
alamb merged commit 0a8fdd5 into apache:main Aug 26, 2026
34 checks passed
@alamb

alamb commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Thank you @Rich-T-kid and @EmilyMatt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-ipc performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants