Problem
benchmarks/benchmarks/pathfinding.py measures a_star_search on the numpy backend only, at grids up to 300x150. The module has four backend paths and a second public function, and most of that surface has no benchmark:
| Function |
numpy |
cupy |
dask |
dask+cupy |
a_star_search |
nx=10/100/300, conn 4/8 |
none |
none |
none |
multi_stop_search |
none |
none |
none |
none |
Gaps:
- Backend gap (HIGH). The dask backend is not the numpy kernel behind a wrapper:
_a_star_dask is a separate sparse Python A* with an LRU chunk cache, and _path_to_dask_array builds the lazy output block by block. A regression there (say, the chunk cache silently reloading blocks) would not show up in any benchmark. The cupy path (device-to-host fallback around the numba kernel) is also unmeasured.
- Missing benchmark (HIGH).
multi_stop_search routes N waypoints through repeated A* calls, stitches the segments, and can reorder waypoints via Held-Karp / 2-opt. None of it is benchmarked, directly or indirectly.
- Small inputs (MEDIUM). The largest input is 300x150 (~45k cells, below 256x256), and nx=10 mostly measures setup overhead.
- Degenerate input (LOW, note only). The input grid has no barriers and no friction, which is the best case for A*. Not fixing here, but worth remembering when reading absolute numbers.
Evidence (executed on this host, CUDA available)
The current benchmark imports and runs (so this is a coverage gap, not a broken benchmark). Candidate timings for the missing paths, per call after warmup:
dask a_star nx=100 0.039 s
dask a_star nx=300 0.304 s
dask a_star nx=1000 3.857 s
cupy a_star nx=100 0.0017 s
cupy a_star nx=300 0.0045 s
cupy a_star nx=1000 0.0486 s
numpy a_star nx=1000 0.0462 s
numpy multi_stop nx=300 ordered 0.0089 s
dask multi_stop nx=300 ordered 0.2407 s
cupy multi_stop nx=300 ordered 0.0131 s
numpy multi_stop nx=100 optimize 0.0249 s
dask multi_stop nx=100 optimize 0.2514 s
Proposed fix (benchmark-only)
Extend benchmarks/benchmarks/pathfinding.py:
AStarSearch: parameterize type over numpy / cupy / dask, sizes [100, 300, 1000] (dask capped at 300 via NotImplementedError in setup; the pure-Python dask A* takes ~4 s at nx=1000 and would dominate suite runtime). Drop nx=10. snap_start/snap_goal stay on for numpy/cupy but off for dask, where they raise by design.
- New
MultiStopSearch class: 4 waypoints on numpy / cupy / dask at [100, 300], timing both the ordered path and optimize_order=True.
dask+cupy stays uncovered: the suite's common.get_xr_dataarray has no dask+cupy type, and no benchmark in the suite parameterizes it. Noting it here rather than growing shared benchmark infra in this change.
No source changes to xrspatial/pathfinding.py.
Problem
benchmarks/benchmarks/pathfinding.pymeasuresa_star_searchon the numpy backend only, at grids up to 300x150. The module has four backend paths and a second public function, and most of that surface has no benchmark:a_star_searchmulti_stop_searchGaps:
_a_star_daskis a separate sparse Python A* with an LRU chunk cache, and_path_to_dask_arraybuilds the lazy output block by block. A regression there (say, the chunk cache silently reloading blocks) would not show up in any benchmark. The cupy path (device-to-host fallback around the numba kernel) is also unmeasured.multi_stop_searchroutes N waypoints through repeated A* calls, stitches the segments, and can reorder waypoints via Held-Karp / 2-opt. None of it is benchmarked, directly or indirectly.Evidence (executed on this host, CUDA available)
The current benchmark imports and runs (so this is a coverage gap, not a broken benchmark). Candidate timings for the missing paths, per call after warmup:
Proposed fix (benchmark-only)
Extend
benchmarks/benchmarks/pathfinding.py:AStarSearch: parameterizetypeover numpy / cupy / dask, sizes[100, 300, 1000](dask capped at 300 viaNotImplementedErrorin setup; the pure-Python dask A* takes ~4 s at nx=1000 and would dominate suite runtime). Drop nx=10.snap_start/snap_goalstay on for numpy/cupy but off for dask, where they raise by design.MultiStopSearchclass: 4 waypoints on numpy / cupy / dask at[100, 300], timing both the ordered path andoptimize_order=True.dask+cupy stays uncovered: the suite's
common.get_xr_dataarrayhas no dask+cupy type, and no benchmark in the suite parameterizes it. Noting it here rather than growing shared benchmark infra in this change.No source changes to
xrspatial/pathfinding.py.