Skip to content

Perf dev ldc

Perf dev ldc #23

Workflow file for this run

name: perf
on:
pull_request:
paths-ignore:
- 'spec/**'
- 'changelog/**'
- '**/*.md'
push:
branches: [master]
concurrency:
group: perf-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
perf:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
OS_NAME: linux
MODEL: 64
FULL_BUILD: false
HOST_DMD: ldc-1.42.0
ENABLE_LTO: 1
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set parallelism
run: echo "N=$(nproc)" >> "$GITHUB_ENV"
- name: Compute base/head SHAs
id: refs
run: |
set -uexo pipefail
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
git fetch --no-tags origin master
BASE_SHA="$(git merge-base "$HEAD_SHA" origin/master)"
echo "head=$HEAD_SHA" >> "$GITHUB_OUTPUT"
echo "base=$BASE_SHA" >> "$GITHUB_OUTPUT"
echo "branch=${GITHUB_BASE_REF:-master}" >> "$GITHUB_OUTPUT"
- name: Install prerequisites
run: |
sudo apt-get update
sudo apt-get install -y valgrind time
valgrind --version
- name: Install host compiler
run: ci/run.sh install_host_compiler
- name: Build dmd at base and head
run: |
set -uexo pipefail
build_ref() {
local dir="$RUNNER_TEMP/$2/dmd"
mkdir -p "$RUNNER_TEMP/$2"
git worktree add --force "$dir" "$1"
( cd "$dir" && ci/run.sh setup_repos "${{ steps.refs.outputs.branch }}" && ci/run.sh build 0 )
}
build_ref "${{ steps.refs.outputs.base }}" base
build_ref "${{ steps.refs.outputs.head }}" head
- name: Measure
run: |
set -uexo pipefail
source ~/dlang/*/activate
built=generated/$OS_NAME/release/$MODEL/dmd
cd tools/perfrunner
dub run -- \
--base-dmd "$RUNNER_TEMP/base/dmd/$built" \
--head-dmd "$RUNNER_TEMP/head/dmd/$built" \
--base-sha "${{ steps.refs.outputs.base }}" \
--head-sha "${{ steps.refs.outputs.head }}" \
--pr "${{ github.event.pull_request.number || 0 }}" \
--host-dmd "$HOST_DMD" \
--out "$GITHUB_WORKSPACE/results.json"
- name: Post sticky PR comment
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: python3 .github/scripts/perf_comment.py results.json