Skip to content

Commit ce4612d

Browse files
authored
Merge pull request #1260 from Shaikh-Ubaid/benchmark_script
Bench: Add benchmark generator script
2 parents b67b871 + ce2edf8 commit ce4612d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/bin/bench_gen.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
3+
N = 10000
4+
5+
A_functions = ""
6+
calls = ""
7+
for i in range(N):
8+
func_A = f"""
9+
def A{i}(x: i32) -> i32:
10+
y: i32
11+
z: i32
12+
y = {i}
13+
z = 5
14+
x = x + y * z
15+
return x
16+
"""
17+
A_functions += func_A
18+
calls += f" y = A{i}(y)\n"
19+
20+
source = f"""\
21+
from ltypes import i32
22+
23+
{A_functions}
24+
25+
def Driver(test_val: i32) -> i32:
26+
y: i32
27+
y = test_val
28+
{calls}
29+
return y
30+
31+
def Main0():
32+
print(Driver(5))
33+
34+
Main0()
35+
"""
36+
37+
print(source)

0 commit comments

Comments
 (0)