-
Notifications
You must be signed in to change notification settings - Fork 0
Improve querying by skipping blocks #173
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves query performance by implementing a block-skipping optimization in the queryEntry function. Instead of reading and parsing all entries sequentially until the target is found, the new implementation skips entire chunks (blocks) that cannot contain the target key by examining only the first entry of each chunk. This leverages the fact that entries within a namespace are stored in sorted order across chunks.
Key changes:
- Rewrote
queryEntryto directly iterate through file frames and skip chunks based on first-entry comparisons - Refactored test assertions from explicit bind syntax to the more idiomatic
shouldReturncombinator
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scls-format/src/Cardano/SCLS/Query.hs | Complete rewrite of queryEntry function to implement block-skipping optimization by examining first entry of each matching namespace chunk and only searching within a chunk when the next chunk's first entry exceeds the target key |
| scls-format/test/QuerySpec.hs | Refactored all test assertions from result <- action; result \shouldBe` expectedpattern to more idiomaticaction `shouldReturn` expected` syntax for improved readability |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
df6d406 to
1e8d25c
Compare
qnikst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Though I've added comments about renaming to things
No description provided.