diff --git a/.claude/sweep-benchmarks-state.csv b/.claude/sweep-benchmarks-state.csv index a60a16744..160a429be 100644 --- a/.claude/sweep-benchmarks-state.csv +++ b/.claude/sweep-benchmarks-state.csv @@ -1,3 +1,4 @@ module,last_inspected,issue,severity_max,categories_found,notes +edge_detection,2026-07-18,3672,MEDIUM,1,"No bench file existed; all 5 public funcs (sobel_x/y, prewitt_x/y, laplacian) uncovered. Compute delegates to convolve_2d (directly benchmarked, but only at 5x5/25x25 kernels, never 3x3, never via the wrappers) so MEDIUM not HIGH. Added benchmarks/benchmarks/edge_detection.py: EdgeDetection class, nx in [300,3000], numpy/cupy/dask, one timing method per public func. All 30 combos executed locally incl. cupy (GPU host). Cat 2/3/4 N/A (module implements no backends itself; no pre-existing bench to be broken)." geotiff,2026-07-02,3603,HIGH,1;2,"No benchmark existed for geotiff; open_geotiff/to_geotiff had zero asv coverage across numpy/dask/cupy. Added benchmarks/benchmarks/geotiff.py: WriteGeoTIFF (numpy/dask/cupy streaming), WriteCOG (numpy/cupy overview pyramid), ReadGeoTIFF (numpy/cupy decode), ReadGeoTIFFChunked (dask). All classes executed locally via direct call; cupy paths run on this GPU host. asv check discover fails suite-wide from an asv_runner + py3.14 metadata bug, unrelated to this file." pathfinding,2026-07-08,3645,HIGH,1;2;3,"Bench covered only numpy a_star_search at nx<=300; module also ships dask (separate sparse-Python A* + LRU chunk cache), cupy fallback, and public multi_stop_search with zero coverage. Extended AStarSearch to numpy/cupy/dask with nx up to 1000 (dask capped at 300, ~4s/call at 1000) and added MultiStopSearch (ordered + optimize_order). All combos executed locally incl. cupy (GPU host). LOW noted, not fixed: open-grid no-barrier/no-friction input is A* best case. dask+cupy not parameterized anywhere in suite (common.get_xr_dataarray has no such type). Existing bench imports/runs fine (Cat 4 clean)." diff --git a/benchmarks/benchmarks/edge_detection.py b/benchmarks/benchmarks/edge_detection.py new file mode 100644 index 000000000..4846e7854 --- /dev/null +++ b/benchmarks/benchmarks/edge_detection.py @@ -0,0 +1,34 @@ +from xrspatial.edge_detection import laplacian, prewitt_x, prewitt_y, sobel_x, sobel_y + +from .common import get_xr_dataarray + + +class EdgeDetection: + params = ([300, 3000], ["numpy", "cupy", "dask"]) + param_names = ("nx", "type") + + def setup(self, nx, type): + ny = nx // 2 + self.agg = get_xr_dataarray((ny, nx), type) + + def _run(self, func): + result = func(self.agg) + # dask returns a lazy array; force the compute so the benchmark + # times the kernel, not just graph construction. + if hasattr(result.data, 'compute'): + result.data.compute() + + def time_sobel_x(self, nx, type): + self._run(sobel_x) + + def time_sobel_y(self, nx, type): + self._run(sobel_y) + + def time_prewitt_x(self, nx, type): + self._run(prewitt_x) + + def time_prewitt_y(self, nx, type): + self._run(prewitt_y) + + def time_laplacian(self, nx, type): + self._run(laplacian)