Skip to content

Commit f6e160e

Browse files
committed
Make benchmarks flexible for multiple N
1 parent 4f12d6b commit f6e160e

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

benchmark/bench_phyjax2d.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,17 @@ def ball_fall_phyjax2d(
104104
return duration
105105

106106

107+
DEFAULT_COUNTS = [1000]
108+
109+
107110
def main(
108-
count_min: int = 1000,
109-
count_max: int = 100000,
110-
count_interval: int = 1000,
111+
counts: list[int] = DEFAULT_COUNTS,
111112
debug_vis: bool = False,
112113
filename: Path = Path("bench.csv"),
113114
) -> None:
114115
results = []
115116

116-
for count in [x for x in range(count_min, count_max + 1, count_interval)]:
117+
for count in counts:
117118
duration = ball_fall_phyjax2d(count, debug_vis)
118119
# Convert timedelta to total seconds as a float for the CSV
119120
seconds = duration.total_seconds()

benchmark/bench_pymunk.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ def ball_fall(n_balls: int, debug_vis: bool, n_iter: int = 1000) -> timedelta:
7272
return datetime.now() - start
7373

7474

75+
DEFAULT_COUNTS = [1000]
76+
77+
7578
def main(
76-
count_min: int = 1000,
77-
count_max: int = 100000,
78-
count_interval: int = 1000,
79+
counts: list[int] = DEFAULT_COUNTS,
7980
debug_vis: bool = False,
8081
filename: Path = Path("bench.csv"),
8182
) -> None:
8283
results = []
8384

84-
for count in [x for x in range(count_min, count_max + 1, count_interval)]:
85+
for count in counts:
8586
duration = ball_fall(count, debug_vis)
8687
# Convert timedelta to total seconds as a float for the CSV
8788
seconds = duration.total_seconds()

0 commit comments

Comments
 (0)