11# Temporary benchmark harness used to collect before/after numbers for the
22# framework performance PRs. Lives only on a scratch branch; never merged.
3+ # Triggered by pushing to the scratch branch; parameters come from
4+ # benchmarks_scratch/run.json ({"base_ref", "head_ref", "bench_script"}).
35name : claude-perf-bench
46
57on :
6- workflow_dispatch :
7- inputs :
8- base_ref :
9- description : Baseline ref to benchmark
10- required : true
11- default : main
12- head_ref :
13- description : Ref with the change applied
14- required : true
15- bench_script :
16- description : Benchmark script path on this branch
17- required : true
8+ push :
9+ branches :
10+ - " claude/reflex-perf-optimizations-01l7a3-bench"
1811
1912permissions :
2013 contents : read
@@ -30,47 +23,53 @@ jobs:
3023 steps :
3124 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3225 with :
33- persist-credentials : false
34-
35- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36- with :
37- ref : ${{ inputs.base_ref }}
38- path : base
39- fetch-depth : 0
40- fetch-tags : true
41- persist-credentials : false
42-
43- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44- with :
45- ref : ${{ inputs.head_ref }}
46- path : head
4726 fetch-depth : 0
4827 fetch-tags : true
4928 persist-credentials : false
5029
5130 - name : Install uv
5231 uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
5332
33+ - name : Prepare base and head worktrees
34+ run : |
35+ BASE_REF=$(jq -r .base_ref benchmarks_scratch/run.json)
36+ HEAD_REF=$(jq -r .head_ref benchmarks_scratch/run.json)
37+ BENCH_SCRIPT=$(jq -r .bench_script benchmarks_scratch/run.json)
38+ echo "BASE_REF=$BASE_REF" >> "$GITHUB_ENV"
39+ echo "HEAD_REF=$HEAD_REF" >> "$GITHUB_ENV"
40+ echo "BENCH_SCRIPT=$BENCH_SCRIPT" >> "$GITHUB_ENV"
41+ git fetch origin "$BASE_REF" "$HEAD_REF"
42+ git worktree add /tmp/bench-base "origin/$BASE_REF"
43+ git worktree add /tmp/bench-head "origin/$HEAD_REF"
44+
5445 - name : Sync base
5546 run : uv sync
56- working-directory : base
47+ working-directory : /tmp/bench- base
5748
5849 - name : Sync head
5950 run : uv sync
60- working-directory : head
51+ working-directory : /tmp/bench- head
6152
62- - name : Bench BASE (${{ inputs.base_ref }})
63- run : uv run --no-sync python "$GITHUB_WORKSPACE/${{ inputs.bench_script }}"
64- working-directory : base
53+ - name : Bench BASE
54+ run : |
55+ echo "=== BASE ($BASE_REF) pass 1 ==="
56+ uv run --no-sync python "$GITHUB_WORKSPACE/$BENCH_SCRIPT"
57+ working-directory : /tmp/bench-base
6558
66- - name : Bench HEAD (${{ inputs.head_ref }})
67- run : uv run --no-sync python "$GITHUB_WORKSPACE/${{ inputs.bench_script }}"
68- working-directory : head
59+ - name : Bench HEAD
60+ run : |
61+ echo "=== HEAD ($HEAD_REF) pass 1 ==="
62+ uv run --no-sync python "$GITHUB_WORKSPACE/$BENCH_SCRIPT"
63+ working-directory : /tmp/bench-head
6964
70- - name : Bench BASE pass 2 (${{ inputs.base_ref }})
71- run : uv run --no-sync python "$GITHUB_WORKSPACE/${{ inputs.bench_script }}"
72- working-directory : base
65+ - name : Bench BASE pass 2
66+ run : |
67+ echo "=== BASE ($BASE_REF) pass 2 ==="
68+ uv run --no-sync python "$GITHUB_WORKSPACE/$BENCH_SCRIPT"
69+ working-directory : /tmp/bench-base
7370
74- - name : Bench HEAD pass 2 (${{ inputs.head_ref }})
75- run : uv run --no-sync python "$GITHUB_WORKSPACE/${{ inputs.bench_script }}"
76- working-directory : head
71+ - name : Bench HEAD pass 2
72+ run : |
73+ echo "=== HEAD ($HEAD_REF) pass 2 ==="
74+ uv run --no-sync python "$GITHUB_WORKSPACE/$BENCH_SCRIPT"
75+ working-directory : /tmp/bench-head
0 commit comments