Repository navigation
feat(perf): Add tile batching optimization for CoolerTileset - #10
Merged
Merged
Conversation
nvictus
force-pushed
the
feat-cooler-tile-batching
branch
from
September 17, 2026 20:00
8778ce6 to
c962c36
Compare
nvictus
force-pushed
the
feat-cooler-tile-batching
branch
from
September 18, 2026 01:26
c962c36 to
1615857
Compare
nvictus
force-pushed
the
feat-cooler-tile-batching
branch
from
September 18, 2026 01:58
1b85f52 to
0074bd1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restores tile batching optimization as found in the legacy cooler tileset, but improved and with greater flexibility.
Tiles from a request batch are grouped by zoom and transform. Then, within a group the reader merges queries whose bin ranges are contiguous in the cooler's own bin ordering. Finally, the merged rectangle is sliced back into per-tile blocks.
Consulting the file's internal ordering rather than what we project on the canvas makes it safe for us to project a chromosome order that differs from the file's
(though, this option is not exposed yet!)This is now exposed via an optionalchromsizesargument to the tileset constructor. Tiles that are adjacent on the canvas are then not adjacent on disk, and simply would not merge.We re-use cooler's internal query engine machinery for the design:
Because pixels are stored CSR, merging fetches of horizontally-adjacent bboxes eliminates multiple fetches of the same matrix rows from disk. For bboxes crossing the diagonal in symmetric-upper mode, vertical consolidation also eliminates redundant I/O.
As an additional optimization, fetches go through cooler's internal query engines rather than
Cooler.matrix()to read the internal index only once for the whole batch.The original, and simpler, non-batched query mode is preserved by passing
batched=False.