Skip to content

Commit ce29a6d

Browse files
committed
update benchmarks
1 parent ae36777 commit ce29a6d

File tree

3 files changed

+70
-8
lines changed

3 files changed

+70
-8
lines changed

.github/workflows/benchmarks.yml

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,25 @@ jobs:
2020
- name: Install Rust
2121
uses: dtolnay/rust-toolchain@stable
2222

23-
- name: Install Native Lua
24-
run: sudo apt-get update && sudo apt-get install -y lua5.4
23+
- name: Install build dependencies
24+
run: sudo apt-get update && sudo apt-get install -y build-essential libreadline-dev unzip
25+
26+
- name: Extract Lua source
27+
run: |
28+
cd lua_src
29+
unzip -o lua-5.4.6.zip
30+
31+
- name: Build and Install Native Lua from source
32+
run: |
33+
cd lua_src/lua-5.4.6
34+
make linux
35+
sudo make install INSTALL_TOP=/usr/local
36+
echo "/usr/local/bin" >> $GITHUB_PATH
37+
38+
- name: Verify Lua installation
39+
run: |
40+
which lua
41+
lua -v
2542
2643
- name: Build Release
2744
run: cargo build --release
@@ -44,19 +61,43 @@ jobs:
4461
- name: Install Rust
4562
uses: dtolnay/rust-toolchain@stable
4663

47-
- name: Install Native Lua
64+
- name: Extract Lua source
65+
shell: pwsh
4866
run: |
49-
choco install lua -y
67+
cd lua_src
68+
Expand-Archive -Path lua-5.4.6.zip -DestinationPath . -Force
69+
70+
- name: Build Native Lua with CMake
71+
shell: pwsh
72+
run: |
73+
cd lua_src/lua-5.4.6
74+
cmake -B build -DCMAKE_BUILD_TYPE=Release -DLUA_BUILD_INTERPRETER=ON
75+
cmake --build build --config Release
76+
# Add to PATH for this job
77+
$luaPath = "$PWD\build\Release"
78+
echo "$luaPath" >> $env:GITHUB_PATH
79+
# Also copy to a known location
80+
New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\lua_bin"
81+
Copy-Item "build\Release\lua.exe" "$env:GITHUB_WORKSPACE\lua_bin\"
82+
83+
- name: Verify Lua installation
84+
shell: pwsh
85+
run: |
86+
$env:PATH = "$env:GITHUB_WORKSPACE\lua_bin;$env:PATH"
87+
& "$env:GITHUB_WORKSPACE\lua_bin\lua.exe" -v
5088
5189
- name: Build Release
5290
run: cargo build --release
5391

5492
- name: Run Benchmarks
5593
shell: pwsh
5694
run: |
95+
$env:PATH = "$env:GITHUB_WORKSPACE\lua_bin;$env:PATH"
5796
echo "## Benchmark Results - Windows (windows-latest)" >> $env:GITHUB_STEP_SUMMARY
5897
echo "" >> $env:GITHUB_STEP_SUMMARY
5998
echo '```' >> $env:GITHUB_STEP_SUMMARY
99+
# Use the lua we built
100+
$env:NATIVE_LUA = "$env:GITHUB_WORKSPACE\lua_bin\lua.exe"
60101
.\run_benchmarks.ps1 2>&1 | Tee-Object -Append -FilePath $env:GITHUB_STEP_SUMMARY
61102
echo '```' >> $env:GITHUB_STEP_SUMMARY
62103
@@ -69,8 +110,25 @@ jobs:
69110
- name: Install Rust
70111
uses: dtolnay/rust-toolchain@stable
71112

72-
- name: Install Native Lua
73-
run: brew install lua
113+
- name: Install build dependencies
114+
run: brew install readline
115+
116+
- name: Extract Lua source
117+
run: |
118+
cd lua_src
119+
unzip -o lua-5.4.6.zip
120+
121+
- name: Build and Install Native Lua from source
122+
run: |
123+
cd lua_src/lua-5.4.6
124+
make macosx
125+
sudo make install INSTALL_TOP=/usr/local
126+
echo "/usr/local/bin" >> $GITHUB_PATH
127+
128+
- name: Verify Lua installation
129+
run: |
130+
which lua
131+
lua -v
74132
75133
- name: Build Release
76134
run: cargo build --release
@@ -82,4 +140,4 @@ jobs:
82140
echo '```' >> $GITHUB_STEP_SUMMARY
83141
chmod +x run_benchmarks.sh
84142
./run_benchmarks.sh 2>&1 | tee -a $GITHUB_STEP_SUMMARY
85-
echo '```' >> $GITHUB_STEP_SUMMARY summary:
143+
echo '```' >> $GITHUB_STEP_SUMMARY

lua_src/lua-5.4.6.zip

384 KB
Binary file not shown.

run_benchmarks.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ $benchmarks = @(
99
"bench_control_flow.lua"
1010
)
1111

12+
# Detect Native Lua executable
13+
$nativeLua = if ($env:NATIVE_LUA) { $env:NATIVE_LUA } else { "lua" }
14+
1215
Write-Host ""
1316
Write-Host "========================================" -ForegroundColor Cyan
1417
Write-Host " Lua-RS vs Native Lua Performance" -ForegroundColor Cyan
1518
Write-Host "========================================" -ForegroundColor Cyan
19+
Write-Host "Native Lua: $nativeLua" -ForegroundColor Gray
1620
Write-Host ""
1721

1822
foreach ($bench in $benchmarks) {
@@ -25,7 +29,7 @@ foreach ($bench in $benchmarks) {
2529

2630
Write-Host ""
2731
Write-Host "--- Native Lua ---" -ForegroundColor Green
28-
& lua "benchmarks\$bench"
32+
& $nativeLua "benchmarks\$bench"
2933

3034
Write-Host ""
3135
Write-Host "----------------------------------------"

0 commit comments

Comments
 (0)