Skip to content

perf: scan the keys on the first BoundedSet lookup or change after a read - #78

Merged
jacopoabramo merged 9 commits into
mainfrom
perf/bounded-set-first-lookup
Oct 26, 2026
Merged

jacopoabramo merged 9 commits into
mainfrom
perf/bounded-set-first-lookup

Conversation

@jacopoabramo

@jacopoabramo jacopoabramo commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner
  • Compare the key with every stored slot on the first in, add, discard or remove after a read, and build the index on a later lookup
  • Remove every stored copy of a key on that first discard or remove
  • Compare 8-byte keys, floats included, in blocks written so the compiler can use SSE2 instructions
  • Drop stored duplicates before a full set refuses an add
  • Add benchbox ops rows that read a set, change one key and write it back
  • Accept the TypeError a forged kind above 5 raises in the forged-bytes test

@jacopoabramo jacopoabramo added the skip-changelog Not listed in the changelog label Oct 26, 2026
@codspeed

codspeed Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by ×3

⚡ 3 improved benchmarks
✅ 72 untouched benchmarks
⏩ 1 skipped benchmark1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_contains_bounded_set[bs64k-65536] 19.9 ms 3 ms ×6.6
⚡ test_contains_bounded_set[bs1k-1024] 353.2 µs 96.6 µs ×3.7
⚡ test_contains_bounded_set[bs16-16] 57.1 µs 51 µs +11.94%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing perf/bounded-set-first-lookup (85df223) with main (ff0b2c4)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩

@jacopoabramo jacopoabramo changed the title perf: scan the keys on the first BoundedSet lookup after a read perf: scan the keys on the first BoundedSet lookup or change after a read Oct 26, 2026
@jacopoabramo
jacopoabramo merged commit 47b081d into main Oct 26, 2026
28 checks passed
@jacopoabramo
jacopoabramo deleted the perf/bounded-set-first-lookup branch October 26, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Not listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant