Skip to content

perf : avoided repeated bounds checks in take kernel - #10441

Open
Rich-T-kid wants to merge 2 commits into
apache:mainfrom
Rich-T-kid:rich-t-kid/avoid-take-bounds-checks
Open

perf : avoided repeated bounds checks in take kernel#10441
Rich-T-kid wants to merge 2 commits into
apache:mainfrom
Rich-T-kid:rich-t-kid/avoid-take-bounds-checks

Conversation

@Rich-T-kid

@Rich-T-kid Rich-T-kid commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

see #8879 (comment) and #8879 (comment)

What changes are included in this PR?

instead of checking length bound for each array we only do this for the first array and then remaining arrays avoid validation. The rational behind this is that record batches are all of the same size.

Are these changes tested?

logically nothing has changed

Are there any user-facing changes?

no

@github-actions github-actions Bot added the arrow Changes to the arrow crate label Jul 27, 2026
@Rich-T-kid
Rich-T-kid force-pushed the rich-t-kid/avoid-take-bounds-checks branch from 6b46564 to 1e0e5a4 Compare July 27, 2026 02:28
Comment thread arrow-select/src/take.rs
let columns = record_batch
.columns()
.iter()
.map(|c| take(c, indices, None))

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.

i thought None = doesnt check bounds? since default on TakeOptions would set check_bounds to false

so this change actually introduces the check where it was previously absent?

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.

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

I may have mis-understood #8879 then.

@alamb alamb changed the title perf : avoided repeated bounds checks perf : avoided repeated bounds checks in take kernel Jul 27, 2026
alamb pushed a commit that referenced this pull request Jul 27, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- works towards #8879.

# Rationale for this change
see
#8879 (comment)

the point of these benchmarks are to measure the change of #10441



<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?
adds benchmarks for `take_record_batch()` . 
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
n/a
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
no
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
@alamb

alamb commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Update to get #10442

@alamb

alamb commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

run benchmarks take_kernels

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5093664692-1277-4x7tq 6.12.85+ #1 SMP Mon May 11 08:17:35 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 rich-t-kid/avoid-take-bounds-checks (5656bd2) to 25569a3 (merge-base) diff
BENCH_NAME=take_kernels
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench take_kernels
BENCH_FILTER=
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)

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                                                                     main                                   rich-t-kid_avoid-take-bounds-checks
-----                                                                     ----                                   -----------------------------------
take bool 1024                                                            1.00   1038.7±1.62ns        ? ?/sec    1.00   1034.7±0.84ns        ? ?/sec
take bool 512                                                             1.00    577.6±1.10ns        ? ?/sec    1.00    575.7±0.74ns        ? ?/sec
take bool null indices 1024                                               1.00   854.0±30.17ns        ? ?/sec    1.06    907.5±8.41ns        ? ?/sec
take bool null values 1024                                                1.00      2.0±0.00µs        ? ?/sec    1.00      2.0±0.00µs        ? ?/sec
take bool null values null indices 1024                                   1.03  1631.0±17.17ns        ? ?/sec    1.00   1588.9±8.20ns        ? ?/sec
take check bounds i32 1024                                                1.02    667.6±1.11ns        ? ?/sec    1.00    654.4±1.35ns        ? ?/sec
take check bounds i32 512                                                 1.00    394.3±0.44ns        ? ?/sec    1.14    450.8±1.39ns        ? ?/sec
take fsb value len: 12, indices: 1024                                     1.00      2.5±0.00µs        ? ?/sec    1.01      2.5±0.00µs        ? ?/sec
take fsb value len: 12, null values, indices: 1024                        1.01      3.5±0.00µs        ? ?/sec    1.00      3.5±0.00µs        ? ?/sec
take fsb value optimized len: 16, indices: 1024                           1.00    595.8±6.36ns        ? ?/sec    1.10    656.6±1.05ns        ? ?/sec
take fsb value optimized len: 16, null values, indices: 1024              1.01   1622.3±2.69ns        ? ?/sec    1.00   1605.1±1.26ns        ? ?/sec
take i32 1024                                                             1.03    528.2±1.24ns        ? ?/sec    1.00    511.7±1.21ns        ? ?/sec
take i32 512                                                              1.00    351.3±1.08ns        ? ?/sec    1.00    351.9±1.52ns        ? ?/sec
take i32 null indices 1024                                                1.00    855.8±1.18ns        ? ?/sec    1.02    871.9±0.75ns        ? ?/sec
take i32 null values 1024                                                 1.00   1550.4±1.40ns        ? ?/sec    1.00   1543.7±1.38ns        ? ?/sec
take i32 null values null indices 1024                                    1.00   1730.2±2.03ns        ? ?/sec    1.00   1735.2±3.37ns        ? ?/sec
take list i32 1024                                                        1.00      8.7±0.03µs        ? ?/sec    1.00      8.8±0.04µs        ? ?/sec
take list i32 512                                                         1.01      4.7±0.06µs        ? ?/sec    1.00      4.7±0.02µs        ? ?/sec
take list i32 null indices 1024                                           1.00     10.2±0.18µs        ? ?/sec    1.00     10.2±0.02µs        ? ?/sec
take list i32 null values 1024                                            1.00      6.2±0.02µs        ? ?/sec    1.00      6.2±0.01µs        ? ?/sec
take list i32 null values null indices 1024                               1.00      7.1±0.04µs        ? ?/sec    1.01      7.2±0.07µs        ? ?/sec
take listview i32 1024                                                    1.00   1060.4±0.88ns        ? ?/sec    1.02   1079.0±2.30ns        ? ?/sec
take listview i32 512                                                     1.00    606.6±0.41ns        ? ?/sec    1.02    619.5±1.19ns        ? ?/sec
take listview i32 null indices 1024                                       1.00   1589.6±1.15ns        ? ?/sec    1.02   1614.9±1.55ns        ? ?/sec
take listview i32 null values 1024                                        1.00   1972.7±1.87ns        ? ?/sec    1.02      2.0±0.00µs        ? ?/sec
take listview i32 null values null indices 1024                           1.00      2.5±0.00µs        ? ?/sec    1.00      2.5±0.00µs        ? ?/sec
take primitive run logical len: 1024, physical len: 512, indices: 1024    1.02     15.6±0.01µs        ? ?/sec    1.00     15.3±0.02µs        ? ?/sec
take str 1024                                                             1.00      8.0±0.01µs        ? ?/sec    1.01      8.1±0.00µs        ? ?/sec
take str 512                                                              1.01      3.7±0.01µs        ? ?/sec    1.00      3.7±0.00µs        ? ?/sec
take str null indices 1024                                                1.00      4.4±0.07µs        ? ?/sec    1.00      4.4±0.06µs        ? ?/sec
take str null indices 512                                                 1.00      2.1±0.03µs        ? ?/sec    1.03      2.2±0.03µs        ? ?/sec
take str null values 1024                                                 1.01      4.9±0.06µs        ? ?/sec    1.00      4.9±0.05µs        ? ?/sec
take str null values null indices 1024                                    1.01      3.2±0.02µs        ? ?/sec    1.00      3.2±0.03µs        ? ?/sec
take stringview 1024                                                      1.00    734.8±1.34ns        ? ?/sec    1.00    734.8±4.91ns        ? ?/sec
take stringview 512                                                       1.16    547.0±1.24ns        ? ?/sec    1.00    470.0±4.35ns        ? ?/sec
take stringview null indices 1024                                         1.07    981.9±2.47ns        ? ?/sec    1.00    915.8±2.31ns        ? ?/sec
take stringview null indices 512                                          1.01    578.1±2.78ns        ? ?/sec    1.00    573.3±1.94ns        ? ?/sec
take stringview null values 1024                                          1.04   1792.8±2.84ns        ? ?/sec    1.00   1722.1±2.40ns        ? ?/sec
take stringview null values null indices 1024                             1.01   1757.5±4.04ns        ? ?/sec    1.00   1737.2±1.87ns        ? ?/sec
take_record_batch 5 primitive cols no nulls 1024                          1.00      3.4±0.02µs        ? ?/sec    1.00      3.4±0.01µs        ? ?/sec
take_record_batch 6 string/binary cols no nulls 1024                      1.04     28.0±0.03µs        ? ?/sec    1.00     26.9±0.04µs        ? ?/sec
take_record_batch 7 mixed cols null values 1024                           1.01     17.7±0.11µs        ? ?/sec    1.00     17.6±0.09µs        ? ?/sec
take_record_batch 7 mixed cols null values null indices 1024              1.00     14.8±0.05µs        ? ?/sec    1.00     14.8±0.04µs        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 410.1s
Peak memory 13.7 MiB
Avg memory 11.1 MiB
CPU user 406.1s
CPU sys 0.0s
Peak spill 0 B

branch

Metric Value
Wall time 410.1s
Peak memory 14.9 MiB
Avg memory 12.4 MiB
CPU user 404.5s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

take_record_batch 5 primitive cols no nulls 1024 1.00 3.4±0.02µs ? ?/sec 1.00 3.4±0.01µs ? ?/sec
take_record_batch 6 string/binary cols no nulls 1024 1.04 28.0±0.03µs ? ?/sec 1.00 26.9±0.04µs ? ?/sec
take_record_batch 7 mixed cols null values 1024 1.01 17.7±0.11µs ? ?/sec 1.00 17.6±0.09µs ? ?/sec
take_record_batch 7 mixed cols null values null indices 1024 1.00 14.8±0.05µs ? ?/sec 1.00 14.8±0.04µs ? ?/sec

yup like @Jefffrey mentioned this actually adds an extra validation step so there isn't much performance gains.

maybe what #8879 was referring to was actually the bounds checks in each of the take_impl branches

@Rich-T-kid
Rich-T-kid force-pushed the rich-t-kid/avoid-take-bounds-checks branch from 5656bd2 to c27953d Compare July 27, 2026 19:05
@Rich-T-kid
Rich-T-kid force-pushed the rich-t-kid/avoid-take-bounds-checks branch from c27953d to 1a626c5 Compare July 27, 2026 19:06
@Rich-T-kid

Rich-T-kid commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author
Image 7-27-26 at 3 08 PM local benchmarks for https://github.com/apache/arrow-rs/commit/1a626c58c524e30c945937be9baeac73932abad5 compared to `main`

the latest commit adds 5 unsafe blocks but they are all within loops which is causing a nice perf boost.

this avoids the length check array[index] does since the bounds are validated before take_impl() is called

Comment thread arrow-select/src/take.rs
// SAFETY: idx is a valid index in indices.nulls() --> idx<indices.len()
if values.value(unsafe { indices.value_unchecked(idx).as_usize() }) {
// SAFETY: caller guarantees all valid indices are in-bounds
if unsafe { values.value_unchecked(indices.value_unchecked(idx).as_usize()) } {

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.

im not sure we can do this, since callers can call take without an unsafe block and with check bounds off and pass in an invalid index; this would cause UB via safe interfaces i believe?

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.

I agree -- though it might be faster to validate the indices once at the start of take_impl and then use the unchecked accessors

We could also potentially add a take_unchecked variant or something to skip the acces check

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

im not sure we can do this, since callers can call take without an unsafe block and with check bounds off and pass in an invalid index; this would cause UB via safe interfaces i believe?

aah, I think ive come full circle to understand what @Dandandan meant in

We can run consider having both bound-checked and non-bound-checked versions of the private kernels, and use them for take_record_batch for doing the take on >1 arrays.

I can update the PR to introduce a new unsafe method that uses unsafe array access methods. The main issue with this would be the code bloat.

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

out of curiosity could you run the benchmarks @Jefffrey. if the perf difference is < +10% This may not even be worth it

@Jefffrey

Copy link
Copy Markdown
Contributor

run benchmark take_kernels

@adriangbot

This comment was marked as duplicate.

@adriangbot

Copy link
Copy Markdown

🤖 Arrow criterion benchmark completed (GKE) | trigger

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

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                                                                     main                                   rich-t-kid_avoid-take-bounds-checks
-----                                                                     ----                                   -----------------------------------
take bool 1024                                                            1.17   1039.0±0.76ns        ? ?/sec    1.00    889.1±0.40ns        ? ?/sec
take bool 512                                                             1.17    577.0±1.52ns        ? ?/sec    1.00    494.7±1.36ns        ? ?/sec
take bool null indices 1024                                               1.01   904.2±33.83ns        ? ?/sec    1.00    891.7±1.53ns        ? ?/sec
take bool null values 1024                                                1.17      2.0±0.00µs        ? ?/sec    1.00   1739.0±0.75ns        ? ?/sec
take bool null values null indices 1024                                   1.00  1602.8±12.81ns        ? ?/sec    1.00  1605.7±12.46ns        ? ?/sec
take check bounds i32 1024                                                1.02    667.2±1.72ns        ? ?/sec    1.00    653.3±0.55ns        ? ?/sec
take check bounds i32 512                                                 1.00    391.5±0.51ns        ? ?/sec    1.15    450.8±0.73ns        ? ?/sec
take fsb value len: 12, indices: 1024                                     1.00      2.5±0.01µs        ? ?/sec    1.00      2.5±0.00µs        ? ?/sec
take fsb value len: 12, null values, indices: 1024                        1.06      3.5±0.00µs        ? ?/sec    1.00      3.3±0.00µs        ? ?/sec
take fsb value optimized len: 16, indices: 1024                           1.08    638.6±2.47ns        ? ?/sec    1.00    591.9±1.02ns        ? ?/sec
take fsb value optimized len: 16, null values, indices: 1024              1.14   1668.7±3.30ns        ? ?/sec    1.00   1464.5±2.11ns        ? ?/sec
take i32 1024                                                             1.03    527.2±0.79ns        ? ?/sec    1.00    512.6±0.74ns        ? ?/sec
take i32 512                                                              1.00    351.4±0.84ns        ? ?/sec    1.00    350.4±0.92ns        ? ?/sec
take i32 null indices 1024                                                1.00    866.8±3.43ns        ? ?/sec    1.02    886.5±1.60ns        ? ?/sec
take i32 null values 1024                                                 1.12   1548.3±1.24ns        ? ?/sec    1.00   1388.0±1.33ns        ? ?/sec
take i32 null values null indices 1024                                    1.00   1729.2±2.11ns        ? ?/sec    1.00   1734.5±2.24ns        ? ?/sec
take list i32 1024                                                        1.01      9.0±0.03µs        ? ?/sec    1.00      8.8±0.03µs        ? ?/sec
take list i32 512                                                         1.01      4.8±0.02µs        ? ?/sec    1.00      4.7±0.01µs        ? ?/sec
take list i32 null indices 1024                                           1.03     10.5±0.02µs        ? ?/sec    1.00     10.2±0.03µs        ? ?/sec
take list i32 null values 1024                                            1.02      6.2±0.01µs        ? ?/sec    1.00      6.0±0.02µs        ? ?/sec
take list i32 null values null indices 1024                               1.02      7.2±0.07µs        ? ?/sec    1.00      7.0±0.04µs        ? ?/sec
take listview i32 1024                                                    1.00    969.4±0.74ns        ? ?/sec    1.10   1067.4±0.88ns        ? ?/sec
take listview i32 512                                                     1.00    600.0±1.12ns        ? ?/sec    1.02    609.2±0.46ns        ? ?/sec
take listview i32 null indices 1024                                       1.04   1677.0±2.02ns        ? ?/sec    1.00   1607.4±2.83ns        ? ?/sec
take listview i32 null values 1024                                        1.11      2.1±0.00µs        ? ?/sec    1.00   1842.5±1.03ns        ? ?/sec
take listview i32 null values null indices 1024                           1.04      2.5±0.00µs        ? ?/sec    1.00      2.4±0.00µs        ? ?/sec
take primitive run logical len: 1024, physical len: 512, indices: 1024    1.00     15.5±0.01µs        ? ?/sec    1.00     15.6±0.01µs        ? ?/sec
take str 1024                                                             1.00      8.0±0.00µs        ? ?/sec    1.02      8.2±0.00µs        ? ?/sec
take str 512                                                              1.00      3.8±0.00µs        ? ?/sec    1.02      3.8±0.00µs        ? ?/sec
take str null indices 1024                                                1.00      4.3±0.07µs        ? ?/sec    1.11      4.8±0.15µs        ? ?/sec
take str null indices 512                                                 1.00      2.1±0.03µs        ? ?/sec    1.10      2.4±0.07µs        ? ?/sec
take str null values 1024                                                 1.00      4.9±0.06µs        ? ?/sec    1.05      5.2±0.09µs        ? ?/sec
take str null values null indices 1024                                    1.00      3.2±0.02µs        ? ?/sec    1.08      3.4±0.05µs        ? ?/sec
take stringview 1024                                                      1.13    905.5±0.96ns        ? ?/sec    1.00    798.9±1.51ns        ? ?/sec
take stringview 512                                                       1.06    565.3±0.69ns        ? ?/sec    1.00    534.0±1.67ns        ? ?/sec
take stringview null indices 1024                                         1.07    979.9±2.25ns        ? ?/sec    1.00    918.0±1.67ns        ? ?/sec
take stringview null indices 512                                          1.00    560.1±0.43ns        ? ?/sec    1.01    568.5±1.30ns        ? ?/sec
take stringview null values 1024                                          1.21   1978.9±1.74ns        ? ?/sec    1.00   1632.9±1.59ns        ? ?/sec
take stringview null values null indices 1024                             1.01   1791.8±2.21ns        ? ?/sec    1.00   1771.2±3.36ns        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 375.1s
Peak memory 14.8 MiB
Avg memory 12.2 MiB
CPU user 371.2s
CPU sys 0.0s
Peak spill 0 B

branch

Metric Value
Wall time 375.1s
Peak memory 15.6 MiB
Avg memory 13.0 MiB
CPU user 369.4s
CPU sys 0.0s
Peak spill 0 B

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.

Thanks for pushing on this @Rich-T-kid

@alamb

alamb commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

10% performance on take which gets called a lot I think is worth pursing if possible

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce bound checks in take kernels

4 participants