Skip to content

Add polygonize benchmark comparing xrspatial vs rasterio#1007

Merged
brendancol merged 1 commit into
masterfrom
issue-1006
Mar 14, 2026
Merged

Add polygonize benchmark comparing xrspatial vs rasterio#1007
brendancol merged 1 commit into
masterfrom
issue-1006

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1006

Summary

  • Adds benchmarks/benchmark_polygonize.py, a standalone comparison of xrspatial polygonize against rasterio.features.shapes (GDAL)
  • Tests 5 raster patterns (few large regions, many small regions, checkerboard, concentric rings with holes, masked blobs) at 4 sizes (100x50 through 2000x1000)
  • Measures wall-clock time with warmup/repeat, checks polygon count and total area agreement between implementations
  • Writes benchmarks/POLYGONIZE_BENCHMARKS.md with timing tables, ratios, and consistency results
  • Follows the same structure as the existing rasterizer_benchmarks.py

Initial results: xrspatial-numpy is faster than rasterio in all 20 configurations. Consistency is 100% (identical polygon counts and areas).

Test plan

  • Run python benchmarks/benchmark_polygonize.py end to end
  • Verify markdown output is generated
  • Check consistency: all pairs show area agreement = 1.0 and matching polygon counts

Standalone benchmark script that compares xrspatial polygonize (numpy
and cupy backends) against rasterio.features.shapes across 5 raster
patterns (few large regions, many small regions, checkerboard,
concentric rings, masked blobs) at 4 resolutions.

Outputs timing tables, consistency checks (polygon count and area
agreement), and a markdown report.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Mar 14, 2026
@brendancol brendancol merged commit be5f984 into master Mar 14, 2026
11 checks passed
@brendancol brendancol deleted the issue-1006 branch May 4, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add polygonize benchmark comparing xrspatial vs rasterio/GDAL

1 participant