Skip to content

Commit 5ef2a91

Browse files
committed
Add performance benchmarking
1 parent ee6449d commit 5ef2a91

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/benchmark.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Performance Benchmark
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
benchmark:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Install D Compiler
12+
uses: dlang-community/setup-dlang@v1
13+
with:
14+
compiler: dmd-2.109.1
15+
16+
- name: Checkout PR branch
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.event.pull_request.head.sha }}
20+
21+
- name: Build dmdbranch
22+
run: |
23+
make -f Makefile HOST_DMD=dmd
24+
mv generated/linux/release/64/dmd dmdbranch
25+
26+
- name: Checkout master branch
27+
uses: actions/checkout@v4
28+
with:
29+
ref: master
30+
path: master
31+
32+
- name: Build dmdmaster
33+
run: |
34+
cd master
35+
make -f Makefile HOST_DMD=dmd
36+
mv generated/linux/release/64/dmd ../dmdmaster
37+
38+
- name: Install benchmarking tools
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y hyperfine time
42+
git clone https://github.com/dlang/phobos.git
43+
44+
- name: Run performance tests
45+
run: |
46+
echo "Current directory contents:"
47+
hyperfine \
48+
--warmup 1 \
49+
--runs 5 \
50+
--export-json hyperfine_results.json \
51+
--show-output \
52+
"./dmdmaster -I./phobos -I./generated/linux/release/64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64/phobos -i=phobos -c -unittest -version=StdUnittest -preview=dip1000 phobos/std/stdio.d" \
53+
"./dmdbranch -I./phobos -I./generated/linux/release/64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64/phobos -i=phobos -c -unittest -version=StdUnittest -preview=dip1000 phobos/std/stdio.d"
54+
55+
# Capture memory usage with time
56+
/usr/bin/time -v -o master_time.txt ./dmdmaster -I./phobos -I./generated/linux/release/64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64/phobos -i=phobos -c -unittest -version=StdUnittest -preview=dip1000 phobos/std/stdio.d
57+
/usr/bin/time -v -o pr_time.txt ./dmdbranch -I./phobos -I./generated/linux/release/64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64 -I/opt/hostedtoolcache/dc/dmd-2.109.1/x64/dmd2/linux/lib64/phobos -i=phobos -c -unittest -version=StdUnittest -preview=dip1000 phobos/std/stdio.d
58+
59+
# Post results to PR
60+
- name: Create benchmark report
61+
uses: actions/github-script@v6
62+
with:
63+
script:
64+
#Some Script to post the results to the PR

0 commit comments

Comments
 (0)