Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace binary search with linear search for epoch construction #723

Merged
merged 15 commits into from
Oct 31, 2022

Conversation

veryordinally
Copy link
Collaborator

No description provided.

@casey casey linked an issue Oct 27, 2022 that may be closed by this pull request
@casey casey marked this pull request as ready for review October 28, 2022 17:22
@veryordinally
Copy link
Collaborator Author

Unrolling the first four epochs gives a very significant speedup for my benchmark of indexing 1000 blocks starting from block 700000. Index time drops from 44 minutes (linear search) to 31 minutes (unrolled loop). Seems worth it.

Will try to use criterion benchmark for this function.

@casey
Copy link
Collaborator

casey commented Oct 28, 2022

Maybe we should unroll the loop the whole way? Each epoch is half as big as the previous, so I think a linear search will always be more performant. Obviously small gains, but it's a little cleaner.

@casey casey merged commit 4d1d785 into ordinals:master Oct 31, 2022
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.

Speed up rarity check in index
2 participants