mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
11a2fc3c2d
This PR separates the "last known valid perf test" commit from the "baseline speedy implementation" commit. It is important for the perf test to be meaningful that the changes between those two commits are benign, say minor API adjustments, so that the perf measurement remains meaningful. This also adds a check on merging to master that tells Slack if the perf test has changed and the `test_sha` file needs updating. The Slack message is conditional on the current commit to avoid excessive noise. CHANGELOG_BEGIN CHANGELOG_END
34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
BASELINE=$1
|
|
|
|
measure() {
|
|
local treeish=$1
|
|
local out=$(mktemp -d)/out.json
|
|
git checkout $treeish >&2
|
|
bazel run daml-lf/scenario-interpreter:scenario-perf -- -rf json -rff $out >&2
|
|
cat $out | jq '.[0].primaryMetric.score'
|
|
}
|
|
|
|
main() {
|
|
local current=$(git rev-parse HEAD)
|
|
|
|
local baseline_perf=$(measure $BASELINE)
|
|
local current_perf=$(measure $current)
|
|
|
|
git checkout $current >&2
|
|
|
|
local speedup=$(printf "%.2f" $(echo "$baseline_perf / $current_perf" | bc -l))
|
|
local progress_5x=$(printf "%05.2f%%" $(echo "100 * l($speedup) / l(5)" | bc -l))
|
|
local progress_10x=$(printf "%05.2f%%" $(echo "100 * l($speedup) / l(10)" | bc -l))
|
|
|
|
echo '{"current-perf": '$current_perf', "baseline-perf": '$baseline_perf', "speedup": "'$speedup'x", "progress_towards_5x": "'$progress_5x'", "progress_towards_10x": "'$progress_10x'", "current-sha": "'$current'", "baseline-sha": "'$BASELINE'"}'
|
|
}
|
|
|
|
main
|