Merged
Conversation
Replace the byte-at-a-time accumulator loop in bitpack_decode with branchless direct-indexed uint64 loads. Each value is extracted by computing its bit offset, loading 8 bytes from that position, and applying a shift+mask -- eliminating all branches from the hot loop. SIMD support (SSE2 on x86-64, NEON on ARM64) adds vectorized mask+store for groups of 4 values. Unsupported platforms use the same branchless scalar code. Profiling on 138M MS-MARCO v2 passages showed bitpack_decode at 19.7% of CPU time for multi-token queries. Closes #140
tjgreen42
added a commit
that referenced
this pull request
Mar 3, 2026
## Summary - Update comparison page with results from benchmark run [22642807624](https://github.com/timescale/pg_textsearch/actions/runs/22642807624) - Overall throughput improved from 2.8x to 3.2x faster than System X - Build time gap narrowed from 2.0x to 1.6x (270s → 234s) - Key improvements since Feb 9: SIMD bitpack decoding (#250), stack-allocated decode buffers (#253), BMW term state pointer indirection (#249), arena allocator rewrite (#231), leader-only merge (#244) ## Testing - Numbers extracted from benchmark run on commit 1b09cc9 - gh-pages branch also needs updating (will push after merge)
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.
Summary
Motivation
Profiling on 138M MS-MARCO v2 showed bitpack_decode at 19.7% of CPU. The original code used a branchy byte-at-a-time accumulator. The new code computes each value's bit offset and does a single branchless uint64 load+shift+mask.
Closes #140
Test plan