|
| 1 | +# Polygonize benchmarks |
| 2 | + |
| 3 | +Generated: 2026-03-14 05:06 UTC |
| 4 | + |
| 5 | +Compares xrspatial polygonize (numpy and cupy backends) against rasterio.features.shapes (GDAL) across 5 region patterns and 4 raster sizes. The **fastest** time in each row is bold. |
| 6 | + |
| 7 | +## Few large regions |
| 8 | + |
| 9 | +### Timings |
| 10 | + |
| 11 | +| size | xrs-numpy | xrs-cupy | rasterio | |
| 12 | +|---:|---:|---:|---:| |
| 13 | +| 100x50 | **0.23 ms** | 7.10 ms | 0.63 ms | |
| 14 | +| 500x250 | **8.03 ms** | 16.2 ms | 15.3 ms | |
| 15 | +| 1000x500 | **36.4 ms** | 43.5 ms | 71.3 ms | |
| 16 | +| 2000x1000 | **150 ms** | 231 ms | 255 ms | |
| 17 | + |
| 18 | +### Relative to xrs-numpy |
| 19 | + |
| 20 | +Values below 1.0 mean the competitor is faster. |
| 21 | + |
| 22 | +| size | xrs-cupy | rasterio | |
| 23 | +|---:|---:|---:| |
| 24 | +| 100x50 | 30.75x | 2.71x | |
| 25 | +| 500x250 | 2.01x | 1.91x | |
| 26 | +| 1000x500 | 1.19x | 1.96x | |
| 27 | +| 2000x1000 | 1.55x | 1.70x | |
| 28 | + |
| 29 | +### Consistency |
| 30 | + |
| 31 | +| pair | area agreement min | area agreement max | count ratio range | |
| 32 | +|:-----|---:|---:|---:| |
| 33 | +| xrs-numpy vs rasterio | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 34 | +| xrs-numpy vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 35 | +| rasterio vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 36 | + |
| 37 | +## Many small regions |
| 38 | + |
| 39 | +### Timings |
| 40 | + |
| 41 | +| size | xrs-numpy | xrs-cupy | rasterio | |
| 42 | +|---:|---:|---:|---:| |
| 43 | +| 100x50 | **28.0 ms** | 45.5 ms | 43.8 ms | |
| 44 | +| 500x250 | **756 ms** | 928 ms | 1186 ms | |
| 45 | +| 1000x500 | **3149 ms** | 3801 ms | 5111 ms | |
| 46 | +| 2000x1000 | **13122 ms** | 15581 ms | 22266 ms | |
| 47 | + |
| 48 | +### Relative to xrs-numpy |
| 49 | + |
| 50 | +Values below 1.0 mean the competitor is faster. |
| 51 | + |
| 52 | +| size | xrs-cupy | rasterio | |
| 53 | +|---:|---:|---:| |
| 54 | +| 100x50 | 1.63x | 1.57x | |
| 55 | +| 500x250 | 1.23x | 1.57x | |
| 56 | +| 1000x500 | 1.21x | 1.62x | |
| 57 | +| 2000x1000 | 1.19x | 1.70x | |
| 58 | + |
| 59 | +### Consistency |
| 60 | + |
| 61 | +| pair | area agreement min | area agreement max | count ratio range | |
| 62 | +|:-----|---:|---:|---:| |
| 63 | +| xrs-numpy vs rasterio | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 64 | +| xrs-numpy vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 65 | +| rasterio vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 66 | + |
| 67 | +## Checkerboard |
| 68 | + |
| 69 | +### Timings |
| 70 | + |
| 71 | +| size | xrs-numpy | xrs-cupy | rasterio | |
| 72 | +|---:|---:|---:|---:| |
| 73 | +| 100x50 | **46.2 ms** | 50.1 ms | 82.2 ms | |
| 74 | +| 500x250 | **797 ms** | 893 ms | 1278 ms | |
| 75 | +| 1000x500 | **3350 ms** | 3629 ms | 5411 ms | |
| 76 | +| 2000x1000 | **13644 ms** | 14809 ms | 22528 ms | |
| 77 | + |
| 78 | +### Relative to xrs-numpy |
| 79 | + |
| 80 | +Values below 1.0 mean the competitor is faster. |
| 81 | + |
| 82 | +| size | xrs-cupy | rasterio | |
| 83 | +|---:|---:|---:| |
| 84 | +| 100x50 | 1.09x | 1.78x | |
| 85 | +| 500x250 | 1.12x | 1.60x | |
| 86 | +| 1000x500 | 1.08x | 1.62x | |
| 87 | +| 2000x1000 | 1.09x | 1.65x | |
| 88 | + |
| 89 | +### Consistency |
| 90 | + |
| 91 | +| pair | area agreement min | area agreement max | count ratio range | |
| 92 | +|:-----|---:|---:|---:| |
| 93 | +| xrs-numpy vs rasterio | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 94 | +| xrs-numpy vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 95 | +| rasterio vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 96 | + |
| 97 | +## Concentric rings (holes) |
| 98 | + |
| 99 | +### Timings |
| 100 | + |
| 101 | +| size | xrs-numpy | xrs-cupy | rasterio | |
| 102 | +|---:|---:|---:|---:| |
| 103 | +| 100x50 | **0.27 ms** | 18.2 ms | 1.33 ms | |
| 104 | +| 500x250 | **2.12 ms** | 34.3 ms | 4.94 ms | |
| 105 | +| 1000x500 | **7.12 ms** | 47.0 ms | 11.0 ms | |
| 106 | +| 2000x1000 | **28.3 ms** | 47.9 ms | 29.9 ms | |
| 107 | + |
| 108 | +### Relative to xrs-numpy |
| 109 | + |
| 110 | +Values below 1.0 mean the competitor is faster. |
| 111 | + |
| 112 | +| size | xrs-cupy | rasterio | |
| 113 | +|---:|---:|---:| |
| 114 | +| 100x50 | 68.18x | 4.98x | |
| 115 | +| 500x250 | 16.18x | 2.33x | |
| 116 | +| 1000x500 | 6.61x | 1.54x | |
| 117 | +| 2000x1000 | 1.70x | 1.06x | |
| 118 | + |
| 119 | +### Consistency |
| 120 | + |
| 121 | +| pair | area agreement min | area agreement max | count ratio range | |
| 122 | +|:-----|---:|---:|---:| |
| 123 | +| xrs-numpy vs rasterio | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 124 | +| xrs-numpy vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 125 | +| rasterio vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 126 | + |
| 127 | +## Large regions + 15% mask |
| 128 | + |
| 129 | +### Timings |
| 130 | + |
| 131 | +| size | xrs-numpy | xrs-cupy | rasterio | |
| 132 | +|---:|---:|---:|---:| |
| 133 | +| 100x50 | **1.21 ms** | 4.52 ms | 3.03 ms | |
| 134 | +| 500x250 | **35.7 ms** | 45.5 ms | 82.1 ms | |
| 135 | +| 1000x500 | **162 ms** | 216 ms | 369 ms | |
| 136 | +| 2000x1000 | **744 ms** | 923 ms | 1692 ms | |
| 137 | + |
| 138 | +### Relative to xrs-numpy |
| 139 | + |
| 140 | +Values below 1.0 mean the competitor is faster. |
| 141 | + |
| 142 | +| size | xrs-cupy | rasterio | |
| 143 | +|---:|---:|---:| |
| 144 | +| 100x50 | 3.74x | 2.51x | |
| 145 | +| 500x250 | 1.27x | 2.30x | |
| 146 | +| 1000x500 | 1.33x | 2.28x | |
| 147 | +| 2000x1000 | 1.24x | 2.27x | |
| 148 | + |
| 149 | +### Consistency |
| 150 | + |
| 151 | +| pair | area agreement min | area agreement max | count ratio range | |
| 152 | +|:-----|---:|---:|---:| |
| 153 | +| xrs-numpy vs rasterio | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 154 | +| xrs-numpy vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
| 155 | +| rasterio vs xrs-cupy | 1.0000 | 1.0000 | 1.00 - 1.00 | |
0 commit comments