|
1 |
| -name: "benchmarks-execute" |
| 1 | +name: "Execution benchmarks" |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
5 |
| - branches: ["main"] |
| 5 | + # TODO(ayush): remove after feat/new-execution is merged |
| 6 | + branches: ["main", "feat/new-execution"] |
6 | 7 | pull_request:
|
7 | 8 | types: [opened, synchronize, reopened, labeled]
|
8 | 9 | branches: ["**"]
|
|
18 | 19 | - ".github/workflows/benchmarks-execute.yml"
|
19 | 20 | workflow_dispatch:
|
20 | 21 |
|
| 22 | +concurrency: |
| 23 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
21 | 26 | env:
|
22 | 27 | CARGO_TERM_COLOR: always
|
23 | 28 |
|
24 | 29 | jobs:
|
25 |
| - execute-benchmarks: |
| 30 | + codspeed-walltime-benchmarks: |
| 31 | + name: Run codspeed walltime benchmarks |
26 | 32 | runs-on:
|
27 | 33 | - runs-on=${{ github.run_id }}
|
28 |
| - - runner=8cpu-linux-x64 |
| 34 | + - family=m5a.xlarge # 2.5Ghz clock speed |
| 35 | + - image=ubuntu24-full-x64 |
| 36 | + - extras=s3-cache |
| 37 | + |
| 38 | + env: |
| 39 | + CODSPEED_RUNNER_MODE: walltime |
| 40 | + |
29 | 41 | steps:
|
| 42 | + - uses: runs-on/action@v1 |
30 | 43 | - uses: actions/checkout@v4
|
31 |
| - |
32 |
| - - name: Set up Rust |
33 |
| - uses: actions-rs/toolchain@v1 |
| 44 | + - uses: dtolnay/rust-toolchain@stable |
| 45 | + - uses: Swatinem/rust-cache@v2 |
34 | 46 | with:
|
35 |
| - profile: minimal |
36 |
| - toolchain: stable |
37 |
| - override: true |
| 47 | + cache-on-failure: true |
38 | 48 |
|
39 |
| - - name: Run execution benchmarks |
40 |
| - working-directory: benchmarks/execute |
41 |
| - run: cargo run | tee benchmark_output.log |
| 49 | + - name: Install cargo-binstall |
| 50 | + uses: cargo-bins/cargo-binstall@main |
| 51 | + - name: Install codspeed |
| 52 | + run: cargo binstall --no-confirm --force cargo-codspeed |
42 | 53 |
|
43 |
| - - name: Parse benchmark results |
| 54 | + - name: Build benchmarks |
44 | 55 | working-directory: benchmarks/execute
|
45 |
| - run: | |
46 |
| - # Determine if running in GitHub Actions environment |
47 |
| - if [ -n "$GITHUB_STEP_SUMMARY" ]; then |
48 |
| - SUMMARY_FILE="$GITHUB_STEP_SUMMARY" |
49 |
| - echo "### Benchmark Results Summary" >> "$SUMMARY_FILE" |
50 |
| - else |
51 |
| - SUMMARY_FILE="benchmark_summary.md" |
52 |
| - echo "### Benchmark Results Summary" > "$SUMMARY_FILE" |
53 |
| - echo "Saving summary to $SUMMARY_FILE" |
54 |
| - fi |
55 |
| -
|
56 |
| - # Set up summary table header |
57 |
| - echo "| Program | Total Time (ms) |" >> "$SUMMARY_FILE" |
58 |
| - echo "| ------- | --------------- |" >> "$SUMMARY_FILE" |
59 |
| -
|
60 |
| - # Variables to track current program and total time |
61 |
| - current_program="" |
62 |
| - total_time=0 |
63 |
| -
|
64 |
| - # Process the output file line by line |
65 |
| - while IFS= read -r line; do |
66 |
| - # Check if line contains "Running program" message |
67 |
| - if [[ $line =~ i\ \[info\]:\ Running\ program:\ ([a-zA-Z0-9_-]+) ]]; then |
68 |
| - # If we were processing a program, output its results |
69 |
| - if [[ -n "$current_program" ]]; then |
70 |
| - echo "| $current_program | $total_time |" >> "$SUMMARY_FILE" |
71 |
| - fi |
72 |
| -
|
73 |
| - # Start tracking new program |
74 |
| - current_program="${BASH_REMATCH[1]}" |
75 |
| - total_time=0 |
76 |
| - fi |
77 |
| -
|
78 |
| - # Check for program completion to catch programs that might have no execution segments |
79 |
| - if [[ $line =~ i\ \[info\]:\ Completed\ program:\ ([a-zA-Z0-9_-]+) ]]; then |
80 |
| - completed_program="${BASH_REMATCH[1]}" |
81 |
| - # If no segments were found for this program, ensure it's still in the output |
82 |
| - if [[ "$current_program" == "$completed_program" && $total_time == 0 ]]; then |
83 |
| - echo "| $current_program | 0 |" >> "$SUMMARY_FILE" |
84 |
| - current_program="" |
85 |
| - fi |
86 |
| - fi |
87 |
| -
|
88 |
| - # Check if line contains execution time (looking for the format with ms or s) |
89 |
| - if [[ $line =~ execute_segment\ \[\ ([0-9.]+)(ms|s)\ \|\ [0-9.]+%\ \]\ segment ]]; then |
90 |
| - segment_time="${BASH_REMATCH[1]}" |
91 |
| - unit="${BASH_REMATCH[2]}" |
| 56 | + run: cargo codspeed build |
| 57 | + - name: Run benchmarks |
| 58 | + uses: CodSpeedHQ/action@v3 |
| 59 | + with: |
| 60 | + working-directory: benchmarks/execute |
| 61 | + run: cargo codspeed run |
| 62 | + token: ${{ secrets.CODSPEED_TOKEN }} |
| 63 | + env: |
| 64 | + CODSPEED_RUNNER_MODE: walltime |
| 65 | + |
| 66 | + codspeed-instrumentation-benchmarks: |
| 67 | + name: Run codspeed instrumentation benchmarks |
| 68 | + runs-on: |
| 69 | + - runs-on=${{ github.run_id }} |
| 70 | + - family=m5a.xlarge |
| 71 | + - image=ubuntu24-full-x64 |
| 72 | + - extras=s3-cache |
| 73 | + if: github.event_name != 'pull_request' |
92 | 74 |
|
93 |
| - # Convert to milliseconds if in seconds |
94 |
| - if [[ "$unit" == "s" ]]; then |
95 |
| - segment_time=$(echo "scale=6; $segment_time * 1000" | bc) |
96 |
| - fi |
| 75 | + env: |
| 76 | + CODSPEED_RUNNER_MODE: instrumentation |
97 | 77 |
|
98 |
| - # Add segment time to total |
99 |
| - total_time=$(echo "scale=6; $total_time + $segment_time" | bc) |
100 |
| - fi |
101 |
| - done < benchmark_output.log |
| 78 | + steps: |
| 79 | + - uses: runs-on/action@v1 |
| 80 | + - uses: actions/checkout@v4 |
| 81 | + - uses: dtolnay/rust-toolchain@stable |
| 82 | + - uses: Swatinem/rust-cache@v2 |
| 83 | + with: |
| 84 | + cache-on-failure: true |
102 | 85 |
|
103 |
| - # Output the last program result if there was one |
104 |
| - if [[ -n "$current_program" ]]; then |
105 |
| - echo "| $current_program | $total_time |" >> "$SUMMARY_FILE" |
106 |
| - fi |
| 86 | + - name: Install cargo-binstall |
| 87 | + uses: cargo-bins/cargo-binstall@main |
| 88 | + - name: Install codspeed |
| 89 | + run: cargo binstall --no-confirm --force cargo-codspeed |
107 | 90 |
|
108 |
| - # If not in GitHub Actions, print the summary to the terminal |
109 |
| - if [ -z "$GITHUB_STEP_SUMMARY" ]; then |
110 |
| - echo -e "\nBenchmark Summary:" |
111 |
| - cat "$SUMMARY_FILE" |
112 |
| - fi |
| 91 | + - name: Build benchmarks |
| 92 | + working-directory: benchmarks/execute |
| 93 | + run: cargo codspeed build |
| 94 | + - name: Run benchmarks |
| 95 | + uses: CodSpeedHQ/action@v3 |
| 96 | + with: |
| 97 | + working-directory: benchmarks/execute |
| 98 | + run: cargo codspeed run |
| 99 | + token: ${{ secrets.CODSPEED_TOKEN }} |
| 100 | + env: |
| 101 | + CODSPEED_RUNNER_MODE: instrumentation |
0 commit comments