Skip to content

feat: add TrieMask::iter_set_bits for efficient bit iteration#126

Merged
DaniPopes merged 2 commits into
mainfrom
dani/trie-mask-iter
Feb 2, 2026
Merged

feat: add TrieMask::iter_set_bits for efficient bit iteration#126
DaniPopes merged 2 commits into
mainfrom
dani/trie-mask-iter

Conversation

@DaniPopes
Copy link
Copy Markdown
Member

Add an iterator method for TrieMask that efficiently iterates over set bits using bit manipulation (trailing_zeros/leading_zeros), avoiding the need to iterate over 0..16 and check is_bit_set for each index.

The iterator implements Iterator, ExactSizeIterator, DoubleEndedIterator, and FusedIterator. Use .rev() for reverse iteration.

Upstream of paradigmxyz/reth#21676

Add an iterator method for TrieMask that efficiently iterates over set
bits using bit manipulation (trailing_zeros/leading_zeros), avoiding
the need to iterate over 0..16 and check is_bit_set for each index.

The iterator implements Iterator, ExactSizeIterator, DoubleEndedIterator,
and FusedIterator. Use .rev() for reverse iteration.
@DaniPopes DaniPopes requested a review from gakonst as a code owner February 1, 2026 19:15
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 1, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing dani/trie-mask-iter (b372ef5) with main (fa56822)

🎉 Hooray! codspeed-rust just leveled up to 4.3.0!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 4 untouched benchmarks

Copy link
Copy Markdown
Member

@gakonst gakonst left a comment

Choose a reason for hiding this comment

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

Looks fine to me cc @mattsse

@DaniPopes DaniPopes merged commit 2b50542 into main Feb 2, 2026
23 checks passed
@DaniPopes DaniPopes deleted the dani/trie-mask-iter branch February 2, 2026 21:57
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