Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scverse/spatialdata-plot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: scverse/spatialdata-plot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: perf/datashader-vectorize-polygon-scale
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Jun 22, 2026

  1. perf(shapes): vectorize datashader polygon scaling

    The datashader path scaled polygons with a per-geometry affinity.scale loop
    (_geometry[is_polygon].apply(lambda g: affinity.scale(...))) — a pure-Python
    loop that dominates large polygon renders (measured ~60% of a 100k-polygon
    render; the prototype's 33s at 1M is almost entirely this loop).
    
    Replace with _scale_geometries: scale every coordinate about each geometry's
    bounding-box centre (affinity.scale's default origin) in one vectorized pass
    via shapely.get_coordinates/set_coordinates. Byte-identical to affinity.scale
    including asymmetric shapes, multipolygons and holes (verified main-vs-branch,
    diff_px=0); ~12x polygons / ~6.5x multipolygons -> ~2x+ end-to-end at 100k,
    growing with n. Only fires for scale != 1.0.
    
    The affine transform loop is left as-is (vectorizing it is ~0.9x: shapely
    coordinate (de)serialization dominates, not the Python callback).
    timtreis committed Jun 22, 2026
    Configuration menu
    Copy the full SHA
    84fb564 View commit details
    Browse the repository at this point in the history
Loading