Skip to content

chore[vortex-array]: add integer casting benchmark#7400

Merged
AdamGS merged 2 commits intodevelopfrom
asubiotto/castbench
Apr 13, 2026
Merged

chore[vortex-array]: add integer casting benchmark#7400
AdamGS merged 2 commits intodevelopfrom
asubiotto/castbench

Conversation

@asubiotto
Copy link
Copy Markdown
Contributor

The motivation is to compare an upcoming perf improvement.

Summary

Testing

The motivation is to compare an upcoming perf improvement.

Signed-off-by: Alfonso Subiotto Marques <alfonso.subiotto@polarsignals.com>
@AdamGS AdamGS enabled auto-merge (squash) April 13, 2026 11:12
@AdamGS AdamGS merged commit ceb8638 into develop Apr 13, 2026
156 of 158 checks passed
@AdamGS AdamGS deleted the asubiotto/castbench branch April 13, 2026 11:22
robert3005 pushed a commit that referenced this pull request Apr 14, 2026
Some of our scan profiles show 10% of scan cpu time is spent in integer
widening casts (nullable dictionary codes). This commit simplifies and
optimizes primitive casts by hoisting a lot of hot loop branching logic.

Specifically, this commit relies on values_fit_in to verify
representability so that we can avoid a potential validity and error
check in the hot loop. Additionally from_trusted_len_iter lets the
destination BufferMut optimize the actual cast instead of using
push_unchecked for each element.

Results locally running the benchmark from #7400. Before:
```
$ cargo bench -p vortex-array --bench cast_primitive
    Finished `bench` profile [optimized + debuginfo] target(s) in 0.16s
     Running benches/cast_primitive.rs (target/release/deps/cast_primitive-598823f32b8f3db0)
Timer precision: 41 ns
cast_primitive      fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ cast_u16_to_u32  384.2 µs      │ 491.6 µs      │ 395.1 µs      │ 397.3 µs      │ 100     │ 100
```
After:
```
cargo bench -p vortex-array --bench cast_primitive
    Finished `bench` profile [optimized + debuginfo] target(s) in 0.17s
     Running benches/cast_primitive.rs (target/release/deps/cast_primitive-598823f32b8f3db0)
Timer precision: 41 ns
cast_primitive      fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ cast_u16_to_u32  6.874 µs      │ 543.7 µs      │ 6.999 µs      │ 12.7 µs       │ 100     │ 100
```

Signed-off-by: Alfonso Subiotto Marques <alfonso.subiotto@polarsignals.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants