Benchmarks¶
These benchmarks compare gometry with Shapely, pyproj, h3-py, Mercantile, and other Python libraries across geometry, coordinate transforms, grids, and spatial indexes.
API comparisons¶
Array construction & I/O¶
| API / input | gometry | Comparator |
|---|---|---|
| from_wkb mixed EWKB 10k mixed EWKB | gometry 1.47 ms 1.67× faster | 2.47 ms Shapely |
| from_arrow mixed GeoArrow WKB 100k mixed GeoArrow WKB / 10% missing | gometry 11.47 ms 2.26× faster | 26.24 ms GeoPandas |
| to_wkb mixed EWKB 10k mixed EWKB | gometry 732.39 us 4.35× faster | 3.19 ms Shapely |
| coords matrix and row_index 100k vertices / float64 matrix + int64 row index | gometry 239.41 us 2.01× faster | 480.23 us Shapely |
| points from NumPy XY 10k NumPy XY | gometry 5.50 us 203.25× faster | 1.13 ms Shapely |
| from WKT mixed geometries 10k realistic mixed WKT | gometry 4.36 ms 3.28× faster | 14.32 ms Shapely |
| from GeoJSON countries 217 countries / 2.26 MB | gometry 16.48 ms 1.59× faster | 26.35 ms Shapely |
Geometry¶
| API / input | gometry | Comparator |
|---|---|---|
| intersects irregular polygon points 12k interior, boundary, and exterior probes | gometry 1.44 ms 1.92× faster | 2.74 ms Shapely |
| prepared polygon contains coordinate probes 100k probes / 1,316-coordinate holed polygon | gometry 4.58 ms 1.91× faster | 8.56 ms Shapely |
| dwithin pairwise 10k pairs / 50% matches | gometry 4.73 us 55.22× faster | 263.41 us Shapely |
| area projected buildings 10k projected buildings | gometry 170.94 us 1.08× faster | 186.09 us Shapely |
| length roads 10k roads / 100k vertices | gometry 137.33 us 1.51× faster | 203.93 us Shapely |
| simplify Douglas-Peucker 10k roads / 100k vertices | gometry 772.93 us 5.35× faster | 4.13 ms Shapely |
| buffer projected points 10k projected points | gometry 828.19 us 62.35× faster | 51.45 ms Shapely |
| intersection pairwise 1k irregular polygon pairs | gometry 7.14 ms Inconclusive | 7.51 ms Shapely |
| intersects pairwise polygons 1k irregular polygon pairs | gometry 620.77 us Inconclusive | 594.60 us Shapely |
| coverage_union_all parcels 10k edge-matched parcels | gometry 5.30 ms Inconclusive | 6.12 ms Shapely |
| is_valid mixed polygons 10k mixed polygons / 20% invalid | gometry 5.50 ms 1.78× faster | 9.90 ms Shapely |
| repair linework 1k invalid polygons | gometry 12.72 ms 7.32× faster | 93.74 ms Shapely |
| bounds projected buildings 10k projected buildings | gometry 147.84 us 1.21× faster | 180.83 us Shapely |
| Intersect short lines with a rectangle 10,000 three-vertex lines; 40% crossing, 40% inside, 20% outside | gometry 13.15 ms 3.45× faster | 45.60 ms Shapely |
| point_on_surface buildings 10k concave and holed buildings | gometry 1.01 ms 2.14× faster | 2.15 ms Shapely |
CRS & geodesy¶
| API / input | gometry | Comparator |
|---|---|---|
| to_crs masked points 200k points / 10% missing ‡ | gometry 7.11 ms 11.13× faster | 78.67 ms GeoPandas |
| crs_transform WGS84 to Web Mercator 10k EPSG:4326 to 3857 | gometry 344.88 us 2.34× faster | 807.41 us pyproj |
| geodesic distance 10k WGS84 pairs † | gometry 8.26 ms Inconclusive | 8.32 ms pyproj |
| geodesic destination 10k WGS84 destinations † | gometry 3.53 ms 1.22× faster | 4.43 ms pyproj + Shapely + GeoPandas |
Discrete global grids¶
| API / input | gometry | Comparator |
|---|---|---|
| geohash encode tokens 10k WGS84 points / precision 6 | gometry 605.88 us 6.84× faster | 4.20 ms pygeohash |
| h3 cover center Brazil Brazil res5 / 32,260 cells | gometry 13.51 ms 2.35× faster | 32.13 ms h3-py |
| h3_compact 32,260 to 1,732 cells | gometry 477.88 us Inconclusive | 487.70 us h3-py |
Spatial index¶
| API / input | gometry | Comparator |
|---|---|---|
| one-shot join within 10k POIs x 217 countries | gometry 44.90 ms 1.41× slower | 31.63 ms Shapely |
| index join within 10k POIs x 217 countries | gometry 14.75 ms 2.10× faster | 31.27 ms Shapely |
| index candidates 1k queries x 10k polygons | gometry 1.46 ms 3.76× faster | 5.48 ms Shapely |
| index nearest k=1 1k non-intersecting queries x 10k polygons | gometry 2.20 ms 2.42× faster | 5.34 ms Shapely |
| exact rectangle query: packed points 256 viewports / 10k projected points / varied hit counts | gometry 1.38 ms 1.21× faster | 1.70 ms Shapely |
| exact rectangle query: mixed geometries 256 viewports / 10k projected points, lines, polygons, and holes | gometry 6.96 ms 3.69× slower | 1.89 ms Shapely |
| exact rectangle query: geographic geometries 256 viewports / 10k mixed EPSG:4326 geometries away from seams and poles | gometry 7.78 ms 4.30× slower | 1.83 ms Shapely |
| index build 10k polygons | gometry 627.46 us 2.10× faster | 1.32 ms Shapely |
† geodesic/ellipsoidal metric. ‡ gometry uses its admitted in-core projection path; this is not a claim about arbitrary CRS transforms.
Reference implementations¶
Ellipsoidal area and length along straight longitude/latitude edges are compared with a Python/NumPy quadrature reference.
| API / input | gometry | Comparator |
|---|---|---|
| ellipsoidal chart-edge country area 217 countries | gometry 166.90 ms 1.27× slower | 131.97 ms Python/NumPy quadrature reference |
| ellipsoidal chart-edge exterior length 1,034 exteriors / 16,135 vertices | gometry 2.50 ms 68.55× faster | 171.40 ms Python/NumPy quadrature reference |
Scaling¶
Call time as input or output size grows. Whiskers show the range across paired process blocks.
Index queries as the index grows¶
1,000 queries against a growing polygon index.
Bounding-box candidates, without exact predicate refinement.
Index queries by hit rate¶
1,000 queries against 10,000 indexed polygons.
Bounding-box candidates, without exact predicate refinement.
Index queries returning more candidates¶
One query returning a growing number of candidates.
Bounding-box candidates, without exact predicate refinement.
Methodology¶
Each workload uses six to twelve paired measurements after warm-up, alternating which library runs first. Outputs are checked for equivalent rows, types, coordinates, and topology before timing.
Ratios summarize paired call times. Labels use confidence intervals with at least 95% coverage and a 3% practical-equivalence margin:
| Label | Meaning |
|---|---|
| Faster / slower | The entire interval is beyond the 3% margin. |
| Similar | The entire interval is within the margin. |
| Inconclusive | The interval is too wide or crosses a decision boundary. |
Measurements used one pinned CPU with the powersave governor and concurrent host activity.
Run environment¶
Measured on AMD Ryzen 9 5950X 16-Core Processor with Linux 7.2.9 and CPython 3.15.0. Benchmark harness commit: d801b232.
Gometry producer source commit: d801b232 (bound to the loaded wheel by its receipt).
Versions: GeoPandas 1.2.0, h3-py 4.5.0, Mercantile 1.2.1, NumPy 2.5.4, pyarrow 26.0.0, pygeohash 3.5.1, pyproj 3.8.0, Shapely 2.2.0, GEOS 3.14.1, PROJ 9.8.1.