Skip to content

Group benchmarks by name #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .github/workflows/kt-bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,37 @@ jobs:
- name: Create provided.js
run: |
shopt -s failglob globstar
names=() jsonargs=()
jsonargs=()
for file in benchmarks/**/*.json; do
name=${file##*/}
name=${name%.*}
name=${name%Bench}
names+=("$name")
jsonargs+=(--slurpfile "$name" "$file")
done
cat >jmh-visualizer/provided.js <<EOF
// provided.js - generated by ${{ github.repository }}/${{ github.workflow }}, $(date +'%Y-%m-%d %H:%M:%S.%N')

var providedBenchmarks = $(jq --null-input --compact-output '$ARGS.positional|unique' --args "${names[@]}");
var providedBenchmarks = $(
jq --null-input --compact-output '
$ARGS.named
| map(.[] | map(.benchmark))
| flatten
| unique
| sort_by([split("[.]|(?<!\\d)(?!\\D)|(?<!\\D)(?!\\d)")|map(try tonumber catch .),.])
' "${jsonargs[@]}"
);

var providedBenchmarkStore = $(jq --null-input '$ARGS.named|map_values(.[0]|sort_by(.benchmark|[split("[.]|(?<!\\d)(?!\\D)|(?<!\\D)(?!\\d)")|map(try tonumber catch .),.]))' "${jsonargs[@]}");
var providedBenchmarkStore = $(
jq --null-input '
$ARGS.named
| to_entries
| map(. as $entry | .value[] | map({key: .benchmark, value: (.benchmark = $entry.key)}))
| flatten
| group_by(.key)
| map({key: .[0].key, value: map(.value)})
| from_entries
' "${jsonargs[@]}"
);
EOF
- run: |
git add jmh-visualizer
Expand Down