-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (175 loc) · 7.93 KB
/
ci.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
schedule:
- cron: '17 15 * * 0'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: master
- name: Check formatting
run: zig fmt --check .
- name: Run tests
run: zig build test
- name: Run standalone tests
run: zig build standalone
- name: Build libzimalloc
run: |
zig build libzimalloc -Doptimize=ReleaseSafe -p zig-out-release-safe
zig build libzimalloc -Doptimize=ReleaseFast -p zig-out-release-fast
- name: Upload libzimalloc
uses: actions/upload-artifact@v4
with:
name: libzimalloc
path: zig-out-*/lib/libzimalloc.so
mimalloc-bench-smoke-test:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: daanx/mimalloc-bench
- name: Get revision
id: bench-revision
run: echo "revision=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Cache benchmarks
id: cache-benchmarks
uses: actions/cache@v4
with:
path: |
extern/
out/
key: mimalloc-bench-${{ steps.bench-revision.outputs.revision }}
- name: Build benchmarks
if: steps.cache-benchmarks.outputs.cache-hit != 'true'
run: |
echo "::group::Install dependencies"
sudo apt-get update
sudo apt-get install dos2unix
echo "::endgroup::"
echo "::group::Build"
./build-bench-env.sh bench lean redis
echo "::endgroup::"
- name: Download libzimalloc artifact
id: download
uses: actions/download-artifact@v4
with:
name: libzimalloc
path: libzimalloc
- name: Setup benchmarks
id: bench-setup
run: |
echo "::group::Install dependencies"
sudo apt-get update
sudo apt-get install ghostscript ruby
echo "::endgroup::"
if command -v nproc > /dev/null; then
procs=$(nproc)
echo "::notice::Using $procs processors"
echo "procs=$procs" >> "$GITHUB_OUTPUT"
echo "procsx2=$((procs * 2))" >> "$GITHUB_OUTPUT"
else
echo "::warning::Could not get number or processors, defaulting to 8"
echo "procs=8" >> "$GITHUB_OUTPUT"
echo "procsx2=16" >> "$GITHUB_OUTPUT"
fi
echo "ld_preload=${{ steps.download.outputs.download-path }}/zig-out-release-safe/lib/libzimalloc.so" >> "$GITHUB_OUTPUT"
echo "redis_version=$(grep -E version_redis= bench.sh | cut -d= -f2)" >> "$GITHUB_OUTPUT"
- name: Run mstress
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/mstress ${{ steps.bench-setup.outputs.procs }} 50 25
- name: Run cscratch
run: |
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/cache-scratch 1 1000 1 2000000 ${{ steps.bench-setup.outputs.procs }}
if test "${{ steps.bench-setup.outputs.procs }}" != "1"; then
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/cache-scratch ${{ steps.bench-setup.outputs.procs }} 1000 1 2000000 ${{ steps.bench-setup.outputs.procs }}
fi
- name: Run cthrash
run: |
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/cache-thrash 1 1000 1 2000000 ${{ steps.bench-setup.outputs.procs }}
if test "${{ steps.bench-setup.outputs.procs }}" != "1"; then
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/cache-thrash ${{ steps.bench-setup.outputs.procs }} 1000 1 2000000 ${{ steps.bench-setup.outputs.procs }}
fi
- name: Run gs
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" gs -dBATCH -dNODISPLAY extern/large.pdf
- name: Run glibc-thread
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/glibc-thread
- name: Run barnes
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/barnes < bench/barnes/input
- name: Run xmalloc-test
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/xmalloc-test -w ${{ steps.bench-setup.outputs.procs }} -t 5 -s 64
- name: Run larson
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/larson 5 8 1000 5000 100 4141 ${{ steps.bench-setup.outputs.procs }}
- name: Run larson-sized
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/larson-sized 5 8 1000 5000 100 4141 ${{ steps.bench-setup.outputs.procs }}
- name: Run malloc-large
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/malloc-large
- name: Run lua
run: |
pushd extern/lua
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" make
make clean
popd
- name: Run redis
run: |
redis_path=extern/redis-${{ steps.bench-setup.outputs.redis_version }}/src
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" $redis_path/redis-server &
sleep 1s
$redis_path/redis-cli flushall
sleep 1s
$redis_path/redis-benchmark -r 1000000 -n 100000 -q -P 16 lpush a 1 2 3 4 5 lrange a 1 5
sleep 1s
$redis_path/redis-cli flushall
sleep 1s
$redis_path/redis-cli shutdown
sleep 1s
- name: Run rbstress
run: |
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" ruby bench/rbstress/stress_mem.rb 1
if test "${{ steps.bench-setup.outputs.procs }}" != "1"; then
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" ruby bench/rbstress/stress_mem.rb ${{ steps.bench-setup.outputs.procs }}
fi
- name: Run espresso
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/espresso bench/espresso/largest.espresso
- name: Run rptest
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/rptest ${{ steps.bench-setup.outputs.procs }} 0 1 2 500 1000 100 8 16000
- name: Run mleak
run: |
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/mleak 5
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/mleak 50
- name: Run alloc-test
run: |
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/alloc-test 1
if test "${{ steps.bench-setup.outputs.procs }}" != "1"; then
if test $procs -gt 16; then
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/alloc-test 16
else
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/alloc-test ${{ steps.bench-setup.outputs.procs }}
fi
fi
- name: Run cfrac
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/cfrac 17545186520507317056371138836327483792789528
- name: Run sh6bench
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/sh6bench ${{ steps.bench-setup.outputs.procsx2 }}
- name: Run glibc-simple
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/glibc-simple
- name: Run lean
run: |
pushd extern/lean/library
LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" ../bin/lean --make -j ${{ steps.bench-setup.outputs.procs }}
pushd ../out/release
make clean-olean
popd
popd
- name: Run sh8bench
run: LD_PRELOAD="${{ steps.bench-setup.outputs.ld_preload }}" out/bench/sh8bench ${{ steps.bench-setup.outputs.procsx2 }}