Skip to content

EliasFano: setBits simplify#19582

Merged
Giulio2002 merged 4 commits intomainfrom
alex/ef_add_off_34
Mar 5, 2026
Merged

EliasFano: setBits simplify#19582
Giulio2002 merged 4 commits intomainfrom
alex/ef_add_off_34

Conversation

@AskAlexSharov
Copy link
Collaborator

@AskAlexSharov AskAlexSharov commented Mar 3, 2026

Changes made:

  1. db/recsplit/eliasfano32/elias_fano.go — Replaced setBits with branchless version (removed width param,
    mask computation, and branch), updated 3 callers
  2. db/recsplit/eliasfano16/elias_fano.go — Same transformation, updated 3 callers
  3. db/recsplit/eliasfano32/elias_fano_seek_bench_test.go — Added BenchmarkAddOffset with stride1/123/1000
    cases
  ┌───────────────┬─────────┬─────────┬─────────┐                                                                                                         
  │    Stride     │ Before  │  After  │ Speedup │                                                                                                         
  ├───────────────┼─────────┼─────────┼─────────┤                                                                                                         
  │ stride1_l0    │ 3.22 ms │ 2.60 ms │ -19%    │                                                                                                         
  ├───────────────┼─────────┼─────────┼─────────┤                                                                                                         
  │ stride123_l6  │ 3.42 ms │ 2.65 ms │ -23%    │                                                                                                         
  ├───────────────┼─────────┼─────────┼─────────┤                                                                                                         
  │ stride1000_l9 │ 3.51 ms │ 2.71 ms │ -23%    │
  └───────────────┴─────────┴─────────┴─────────┘

@AskAlexSharov AskAlexSharov marked this pull request as ready for review March 4, 2026 05:28
@AskAlexSharov AskAlexSharov marked this pull request as draft March 4, 2026 05:28
@AskAlexSharov AskAlexSharov marked this pull request as ready for review March 5, 2026 04:22
Copy link
Collaborator

@Giulio2002 Giulio2002 left a comment

Choose a reason for hiding this comment

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

LGTM — clean simplification of setBits: removes unused width param, uses |= with unconditional second write (safe due to +1 padding). Nice BCE hint addition.

@Giulio2002 Giulio2002 merged commit 2301532 into main Mar 5, 2026
58 checks passed
@Giulio2002 Giulio2002 deleted the alex/ef_add_off_34 branch March 5, 2026 07:01
@AskAlexSharov AskAlexSharov changed the title recsplit: setBits simplify EliasFano: setBits simplify Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants