feat: add opt-in rasterization tiles#3
Draft
stanbot8 wants to merge 2 commits into
Draft
Conversation
stanbot8
force-pushed
the
staging/rasterize-output-tiling
branch
2 times, most recently
from
July 24, 2026 18:20
6b45e6a to
8c23041
Compare
stanbot8
force-pushed
the
staging/rasterize-output-tiling
branch
from
July 24, 2026 20:26
8c23041 to
aab46d8
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.
Preview. Text in square brackets becomes links in the submission.
Two implementations exist. This one uses 2 commits: the same 1st commit as PR 1167, then an opt-in tiling commit. The other implementation uses 1 output canvas and only removes the label-count limit. Compare the limitations.
Summary
Add optional output tiles to rasterization.
tile_size=Nonekeeps the current behavior. A positivetile_sizelimits each spatial output chunk. It also limits each Datashader canvas for points and shapes. This branch fixes the label-count failure in [issue 987]. Closes issue 987.Design
Images and labels pass bounded output chunks to the affine transform. Points use half-open internal tile bounds. Shapes use a 1-pixel halo and crop it. One spatial index selects the shapes for each tile. Sorted positions preserve Datashader
firstsemantics.The change is in [
rasterize.py].Benchmark
The benchmark rasterized a
3 × 4096 × 4096float32image. The output size was192 MiB. Each result was stored in a memory-mapped file with single-threaded Dask. The table shows medians from7runs on an Intel Core i7-8700K.tile_sizeNone192 MiB2574.400 s398.2 MiB102412 MiB7564.009 s-8.9%221.2 MiB44.5%5123 MiB12203.682 s-16.3%216.2 MiB45.7%2560.75 MiB26284.500 s+2.3%218.5 MiB45.1%For this workload,
tile_size=1024reduced the peak RSS increase by44.5%.The image benchmark source and recorded results use candidate
aab46d8ec96acb9213a51cd244397a12a2f0579f.An indexed-shape benchmark used
4096shapes and64tiles. The index reduced the Datashader input from262145to5042rows (98.1%). It reduced the largest tile input from4096to81shapes (98.0%). The median time fell from1.443 sto0.957 s(33.7%). Both outputs had the same checksum. See the shape benchmark source and recorded results.Benchmark commands
Limitations
Smaller tiles create more graph tasks. A shape that crosses tile boundaries is rendered in each intersecting tile.
Tests
Raster tests verify bounded chunks for 2D images, 2D labels, and 3D multiscale images. Point tests cover internal tile edges, global maximum bounds, and uneven tile sizes. Shape tests cover overlaps and categorical channels. Each tiled result is identical to the untiled result.
The rasterization test file passes with
14tests. The complete suite passes with1371tests,7skips, and1expected failure.The tests are in [
test_rasterize.py].Commands