Skip to content

Conversation

@joaosreis
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a 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 queryEntry to directly iterate through file frames and skip chunks based on first-entry comparisons
  • Refactored test assertions from explicit bind syntax to the more idiomatic shouldReturn combinator

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.

@joaosreis joaosreis linked an issue Dec 16, 2025 that may be closed by this pull request
@joaosreis joaosreis force-pushed the 111-improve-querying-by-skipping-blocks branch from df6d406 to 1e8d25c Compare December 16, 2025 10:29
@joaosreis joaosreis requested a review from qnikst December 16, 2025 15:06
Copy link
Collaborator

@qnikst qnikst left a 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

@joaosreis joaosreis merged commit e8827f2 into main Dec 16, 2025
9 checks passed
@joaosreis joaosreis deleted the 111-improve-querying-by-skipping-blocks branch December 16, 2025 16:54
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.

Improve querying by skipping blocks

3 participants