It seems that we can get a large speedup in calls to peak_local_max when the default min_distance=1 is specified. A bottleneck in that function can be the call to ensure_spacing which falls back to the CPU, but we don't need to call that function at all unless min_distance>1 (no coordinates can be excluded if min_distance=1, so it is pointless to call it).
It seems that we can get a large speedup in calls to
peak_local_max
when the defaultmin_distance=1
is specified. A bottleneck in that function can be the call toensure_spacing
which falls back to the CPU, but we don't need to call that function at all unlessmin_distance>1
(no coordinates can be excluded if min_distance=1, so it is pointless to call it).I proposed the same changes upstream in https://github.com/scikit-image/scikit-image/pull/7548. See additional comments and measurements made there.
There should be no change in behavior with this MR, it is purely a performance improvement.