-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark.sh
More file actions
executable file
·63 lines (51 loc) · 1.38 KB
/
benchmark.sh
File metadata and controls
executable file
·63 lines (51 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo "======================================="
echo "Mini-Luau-JIT Benchmark Suite"
echo "======================================="
echo ""
# Check if standard lua is available
if ! command -v lua &> /dev/null; then
echo -e "${YELLOW}Warning: Standard lua not found. Will only test our implementation.${NC}"
HAS_LUA=false
else
HAS_LUA=true
echo "Standard lua version:"
lua -v
echo ""
fi
run_benchmark() {
local name=$1
local file=$2
echo -e "${BLUE}Running benchmark: $name${NC}"
echo "-----------------------------------"
if [ "$HAS_LUA" = true ]; then
echo "Standard Lua (interpreted):"
time lua "$file" 2>&1
echo ""
fi
echo "Our implementation (interpreted):"
time ./luau "$file" 2>&1
echo ""
echo "Our implementation (JIT):"
time ./luau --jit "$file" 2>&1
echo ""
echo "-----------------------------------"
echo ""
}
# Build if needed
if [ ! -f "./luau" ]; then
echo "Building luau..."
make clean && make
echo ""
fi
# Run benchmarks
run_benchmark "Arithmetic Operations" "benchmarks/arithmetic.lua"
run_benchmark "Fibonacci" "benchmarks/fibonacci.lua"
echo "======================================="
echo "Benchmark Complete"
echo "======================================="