Benchmarking automatically (#795)
Co-authored-by: Amaury Chamayou <amaury@xargs.fr>
This commit is contained in:
committed by
GitHub
parent
3385660fd7
commit
0b70ad97a6
72
.github/workflows/benchmark.yml
vendored
Normal file
72
.github/workflows/benchmark.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
name: snmalloc Benchmarking CI
|
||||
|
||||
# The following should ensure that the workflow only runs a single set of actions
|
||||
# for each PR. But it will not apply this to pushes to the main branch.
|
||||
concurrency:
|
||||
group: benchmarking${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 1" # Runs every Monday at midnight UTC
|
||||
# Triggers the workflow on push or pull request events but only for the master branch
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
benchmark:
|
||||
runs-on: [self-hosted, 1ES.Pool=snmalloc-perf]
|
||||
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Setup docker buildx
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and run benchmarks in Docker
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: benchmark/Dockerfile
|
||||
push: false
|
||||
load: true
|
||||
tags: snmalloc-bench
|
||||
build-args: |
|
||||
benchs=allt
|
||||
repeats=5
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
# Extracts the benchmark results from the Docker container
|
||||
- name: Extract Benchmark Results
|
||||
run: |
|
||||
docker cp `docker run -d ${{ steps.docker_build.outputs.imageid }}`:/bencher.dev.sn.json .
|
||||
|
||||
# Uploads the benchmark results as an artifact
|
||||
- name: Upload Benchmark Results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: benchmark-results
|
||||
path: bencher.dev.sn.json
|
||||
|
||||
# Upload to graphing service
|
||||
- uses: bencherdev/bencher@main
|
||||
- name: Upload benchmark results to Bencher
|
||||
run: |
|
||||
bencher run \
|
||||
--project snmalloc \
|
||||
--token '${{ secrets.BENCHER_DEV_API_TOKEN }}' \
|
||||
--branch main \
|
||||
--adapter json \
|
||||
--err \
|
||||
--file bencher.dev.sn.json
|
||||
45
benchmark/Dockerfile
Normal file
45
benchmark/Dockerfile
Normal file
@@ -0,0 +1,45 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
# Pull mimalloc-bench
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git gpg ca-certificates python3-numpy
|
||||
RUN git clone https://github.com/daanx/mimalloc-bench &&\
|
||||
cd mimalloc-bench && \
|
||||
git reset --hard a4ce904286365c7adfba54f0eea3a2df3fc95bd1
|
||||
|
||||
WORKDIR /mimalloc-bench
|
||||
# Install dependencies
|
||||
RUN ./build-bench-env.sh packages
|
||||
|
||||
# Tidy up apt cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Build benchmarks
|
||||
RUN ./build-bench-env.sh bench
|
||||
|
||||
RUN ./build-bench-env.sh redis
|
||||
|
||||
RUN ./build-bench-env.sh rocksdb \
|
||||
&& find /mimalloc-bench/extern/rocksdb-8.1.1 -name "*.o" -delete
|
||||
|
||||
RUN ./build-bench-env.sh lean \
|
||||
&& find /mimalloc-bench/extern/lean -name "*.o" -delete
|
||||
|
||||
RUN echo "sn /snmalloc/build/libsnmallocshim.so" > /allocs.txt
|
||||
|
||||
# Build allocator
|
||||
RUN mkdir -p /snmalloc
|
||||
COPY . /snmalloc
|
||||
|
||||
RUN mkdir -p /snmalloc/build
|
||||
WORKDIR /snmalloc/build
|
||||
RUN cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
|
||||
RUN ninja libsnmallocshim.so
|
||||
|
||||
# Run benchmarks
|
||||
ARG benchs=allt
|
||||
ARG repeats=1
|
||||
WORKDIR /mimalloc-bench/out/bench
|
||||
RUN ../../bench.sh --external=/allocs.txt $benchs -r=$repeats
|
||||
|
||||
WORKDIR /
|
||||
RUN python3 /mimalloc-bench/scripts/bencher.dev.py /mimalloc-bench/out/bench/benchres.csv
|
||||
@@ -1,3 +1,9 @@
|
||||
#if defined(SNMALLOC_ENABLE_GWP_ASAN_INTEGRATION)
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
# include <functional>
|
||||
# include <limits.h>
|
||||
# include <stdio.h>
|
||||
@@ -353,3 +359,4 @@ int main()
|
||||
test_xallocx<mallocx, dallocx, xallocx>();
|
||||
# endif
|
||||
}
|
||||
#endif // SNMALLOC_ENABLE_GWP_ASAN_INTEGRATION
|
||||
Reference in New Issue
Block a user