Skip to content

Commit 3402d56

Browse files
authored
Add hillshade benchmarking, for numpy, cupy and rtxpy (#625)
1 parent 836ebcc commit 3402d56

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

benchmarks/benchmarks/hillshade.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from xrspatial import hillshade
2+
from .common import get_xr_dataarray
3+
4+
5+
class Hillshade:
6+
# Note that rtxpy hillshade includes shadow calculations so timings are
7+
# not comparable with numpy and cupy hillshade.
8+
params = ([100, 300, 1000, 3000], ["numpy", "cupy", "rtxpy"])
9+
param_names = ("nx", "type")
10+
11+
def setup(self, nx, type):
12+
ny = nx // 2
13+
self.xr = get_xr_dataarray(
14+
(ny, nx), type, different_each_call=(type == "rtxpy"))
15+
16+
def time_hillshade(self, nx, type):
17+
shadows = (type == "rtxpy")
18+
hillshade(self.xr, shadows=shadows)

0 commit comments

Comments
 (0)