mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Since callgrind allows to control stats collection from the guest, this allows us to reset the collection right before the benchmark starts. This change exposes this to the benchmark runner and integrates callgrind data parsing into bench.py, so that we can run bench.py with --callgrind argument and, as long as the runner was built with callgrind support, we get instruction counts from the run. We convert instruction counts to seconds using 10G instructions/second rate; there's no correct way to do this without simulating the full CPU pipeline but it results in time units on a similar scale to real runs.
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
name: benchmark
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "papers/**"
|
|
- "rfcs/**"
|
|
- "*.md"
|
|
- "prototyping/**"
|
|
|
|
jobs:
|
|
callgrind:
|
|
name: callgrind ${{ matrix.compiler }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-22.04]
|
|
compiler: [g++]
|
|
benchResultsRepo:
|
|
- { name: "luau-lang/benchmark-data", branch: "main" }
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout Luau repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install valgrind
|
|
run: |
|
|
sudo apt-get install valgrind
|
|
|
|
- name: Build Luau
|
|
run: CXX=${{ matrix.compiler }} make config=release CALLGRIND=1 luau
|
|
|
|
- name: Run benchmark
|
|
run: |
|
|
python bench/bench.py --callgrind --vm "./luau -O2" | tee output.txt
|
|
|
|
- name: Checkout benchmark results
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: ${{ matrix.benchResultsRepo.name }}
|
|
ref: ${{ matrix.benchResultsRepo.branch }}
|
|
token: ${{ secrets.BENCH_GITHUB_TOKEN }}
|
|
path: "./gh-pages"
|
|
|
|
- name: Store results
|
|
uses: Roblox/rhysd-github-action-benchmark@v-luau
|
|
with:
|
|
name: callgrind ${{ matrix.compiler }}
|
|
tool: "benchmarkluau"
|
|
output-file-path: ./output.txt
|
|
external-data-json-path: ./gh-pages/bench/data.json
|
|
|
|
- name: Push benchmark results
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
echo "Pushing benchmark results..."
|
|
cd gh-pages
|
|
git config user.name github-actions
|
|
git config user.email github@users.noreply.github.com
|
|
git add ./bench/data.json
|
|
git commit -m "Add benchmarks results for ${{ github.sha }}"
|
|
git push
|
|
cd ..
|