Skip to content

Add OSM road benchmark (pyogrio / Geofabrik extracts) - #76

Closed
tomalrussell wants to merge 1 commit into
perf/61-osm-benchmarksfrom
codex/continue-work-on-issue-#61-benchmarks
Closed

Add OSM road benchmark (pyogrio / Geofabrik extracts)#76
tomalrussell wants to merge 1 commit into
perf/61-osm-benchmarksfrom
codex/continue-work-on-issue-#61-benchmarks

Conversation

@tomalrussell

Copy link
Copy Markdown
Member

Motivation

  • Provide a reproducible benchmark for issue Measure performance with ~1M node/edge network #61 that measures snkit topology performance on realistic OSM extracts.
  • Avoid fragile pyrosm usage by reading the GDAL OSM lines layer via pyogrio to be robust in different environments.
  • Cache downloads atomically under .benchmark-data and exclude them from measured intervals to ensure repeatable timings.
  • Produce machine-readable results including platform and Python metadata so benchmarks can be archived and compared.

Description

  • Add benchmarks/benchmark_osm_roads.py, which downloads Geofabrik extracts, reads highway ways via geopandas + pyogrio, and times four steps: reading highway ways, creating endpoint nodes, assigning IDs, and assigning topology IDs, and supports all and --output for JSON reports.
  • Implement atomic cached downloads with cleanup of partial files to .benchmark-data and add .benchmark-data/ to .gitignore.
  • Replace the previous pyrosm-based approach with read_highway_ways that filters GDAL lines for highway IS NOT NULL and sanitises geometries.
  • Add benchmarks/README.md documenting how to run the benchmark and add the benchmark optional dependency (pyogrio>=0.7) to pyproject.toml.

Testing

  • Verified benchmarks/benchmark_osm_roads.py compiles with python -m py_compile and passes ruff formatting and lint checks.
  • Confirmed the GDAL OSM driver is available via pyogrio.list_drivers() on the environment used for testing.
  • Exercised the full benchmark pipeline with a synthetic read_highway_ways replacement and validated expected edges/nodes counts and that timing fields read_highway_ways, create_endpoint_nodes, add_ids, and add_topology_ids are present.
  • Attempted real downloads but the execution environment blocked outbound HTTP(S) (HTTP 403 via proxy), so live Oxfordshire/France runs could not be completed and no real PBFs were produced; partial-download cleanup was verified.
  • Ran the test suite which produced 23 passed, 1 skipped, 1 failed; the single failure is unrelated to the benchmark and is caused by the optional networkx package not being installed in the test environment.

Codex Task

@tomalrussell
tomalrussell deleted the branch perf/61-osm-benchmarks August 24, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant