Skip to content

Commit 15b9e8e

Browse files
committedSep 3, 2024
Update bench.sh
1 parent c01039e commit 15b9e8e

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.bin

‎bench.sh

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
#!/bin/bash
2-
COMPILE="mojo build *.mojo"
3-
BENCH="hyperfine -N -w 10 "
2+
BENCH="hyperfine -i -N -w 10 "
43

54
for dir in *; do
6-
if [ -d "$dir" ]; then
7-
COMMANDS=("python ${dir}.py")
8-
COMMANDS+=($dir)
9-
cd "$dir"
10-
echo
11-
echo "Benchmarking $dir"
12-
echo "======================"
13-
$COMPILE
14-
$BENCH "${COMMANDS[@]}"
15-
cd ..
16-
fi
5+
if [ -d "$dir" ]; then
6+
# Compile command with the name
7+
COMPILE="mojo build ${dir}.mojo -o ${dir}.bin"
8+
# Generate commands to run
9+
COMMANDS=("python ${dir}.py")
10+
COMMANDS+=("mojo ${dir}.mojo")
11+
COMMANDS+=(${dir}.bin)
12+
cd "$dir"
13+
echo
14+
echo "Benchmarking $dir"
15+
echo "======================"
16+
# Compile mojo first
17+
$COMPILE
18+
# Run Benchmark with all the commands
19+
$BENCH "${COMMANDS[@]}"
20+
cd ..
21+
fi
1722
done

0 commit comments

Comments
 (0)