File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1467,5 +1467,32 @@ def expand_to(state):
14671467 _ = ds .expand_to (child_ds , ndim = ndim )
14681468
14691469
1470+ @google_benchmark .register
1471+ def map_py (state ):
1472+ """Benchmark for kd.map_py."""
1473+ x = kd .range (int (1e3 ))
1474+ fn = lambda x : x + 1
1475+ while state :
1476+ _ = kd .map_py (fn , x )
1477+
1478+
1479+ @google_benchmark .register
1480+ def map_with_traced_fn (state ):
1481+ """Benchmark for kd.map with a traced fn inside."""
1482+ x = kd .range (int (1e3 ))
1483+ fn = kd .fn (lambda x : x + 1 )
1484+ while state :
1485+ _ = kd .map (fn , x )
1486+
1487+
1488+ @google_benchmark .register
1489+ def map_with_py_fn (state ):
1490+ """Benchmark for kd.map with a py_fn inside."""
1491+ x = kd .range (int (1e3 ))
1492+ fn = kd .py_fn (lambda x : x + 1 )
1493+ while state :
1494+ _ = kd .map (fn , x )
1495+
1496+
14701497if __name__ == '__main__' :
14711498 google_benchmark .main ()
You can’t perform that action at this time.
0 commit comments