Skip to content

Commit 987a3a7

Browse files
committed
Benchmark function compilation
1 parent 0b6ef2a commit 987a3a7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/compile/function/test_types.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,3 +1357,17 @@ def test_minimal_random_function_call_benchmark(trust_input, benchmark):
13571357

13581358
rng_val = np.random.default_rng()
13591359
benchmark(f, rng_val)
1360+
1361+
1362+
@pytest.mark.parametrize("mode", ["FAST_COMPILE", "FAST_RUN"])
1363+
@pytest.mark.parametrize("depth", [2, 20])
1364+
def test_function_compilation_benchmark(mode, depth, benchmark):
1365+
def compile_function(mode=mode, depth=depth):
1366+
x = pt.matrix("x")
1367+
out = x
1368+
for _ in range(depth):
1369+
out = pt.sin(out.T) + pt.cos(out)
1370+
fn = function([x], out, mode=mode)
1371+
return fn
1372+
1373+
benchmark.pedantic(compile_function, iterations=20, rounds=5)

0 commit comments

Comments
 (0)