fix: performance regression for filtering ListView#5390
Merged
Conversation
Signed-off-by: Andrew Duffy <[email protected]>
Timer precision: 41 ns listview_rebuild fastest │ slowest │ median │ mean │ samples │ iters ╰─ rebuild_naive 109.5 µs │ 192.2 µs │ 121.1 µs │ 122 µs │ 100 │ 100 Signed-off-by: Andrew Duffy <[email protected]>
Signed-off-by: Andrew Duffy <[email protected]>
robert3005
approved these changes
Nov 18, 2025
Contributor
robert3005
left a comment
There was a problem hiding this comment.
We could do a take but this is also fine
Signed-off-by: Andrew Duffy <[email protected]>
Signed-off-by: Andrew Duffy <[email protected]>
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
asubiotto
pushed a commit
to polarsignals/vortex
that referenced
this pull request
Nov 19, 2025
In vortex-data#4946, we forced rebuilding ListView arrays that were being built. A user report came in with a 10x performance regression with lots of time being spent inside of ZSTD decompression. On further investigation, the flame graph clarified that inside of a file scan, we were filtering a ListView array, where the elements were ZSTD compressed. Calling `naive_rebuild` goes through an awful `append_scalar` pathway, and `scalar_at` for ZSTD...decompresses a whole frame. To avoid this, we fully canonicalize the elements, offsets, and sizes in bulk, then stitch a new ListView from the components. This is 10-20x faster than the previous codepath, per the added benchmark. Before: ``` Timer precision: 41 ns listview_rebuild fastest │ slowest │ median │ mean │ samples │ iters ╰─ rebuild_naive 1.821 ms │ 2.535 ms │ 2.019 ms │ 2.024 ms │ 100 │ 100 ``` After: ``` Timer precision: 41 ns listview_rebuild fastest │ slowest │ median │ mean │ samples │ iters ╰─ rebuild_naive 109.5 µs │ 192.2 µs │ 121.1 µs │ 122 µs │ 100 │ 100 ``` --------- Signed-off-by: Andrew Duffy <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #4946, we forced rebuilding ListView arrays that were being built.
A user report came in with a 10x performance regression with lots of time being spent inside of ZSTD decompression. On further investigation, the flame graph clarified that inside of a file scan, we were filtering a ListView array, where the elements were ZSTD compressed. Calling
naive_rebuildgoes through an awfulappend_scalarpathway, andscalar_atfor ZSTD...decompresses a whole frame.To avoid this, we fully canonicalize the elements, offsets, and sizes in bulk, then stitch a new ListView from the components.
This is 10-20x faster than the previous codepath, per the added benchmark.
Before:
After: