Compare commits

...

2 Commits

Author SHA1 Message Date
ci-bot
5a2fe5cb0c Update matrix-timing-tests timings 2025-05-29 20:11:03 +00:00
bbbbd25b58 Fixing timing test runner
All checks were successful
Merge-Checker / Benchmarking (pull_request) Successful in 23s
Merge-Checker / build_and_test (pull_request) Successful in 17s
2025-05-29 16:10:37 -04:00
2 changed files with 72 additions and 53 deletions

View File

@@ -7,7 +7,7 @@ on:
- 'unit-tests/timing-results/**' - 'unit-tests/timing-results/**'
jobs: jobs:
build_and_test: Benchmarking:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -28,7 +28,7 @@ jobs:
- name: Build with Ninja - name: Build with Ninja
run: ninja -C build/ run: ninja -C build/
- name: Run matrix-timing-tests with per-test timing output and save results - name: Run matrix-timing-tests
run: | run: |
mkdir -p unit-tests/timing-results mkdir -p unit-tests/timing-results
if [ -x build/unit-tests/matrix-timing-tests ]; then if [ -x build/unit-tests/matrix-timing-tests ]; then
@@ -39,43 +39,62 @@ jobs:
echo "matrix-timing-tests executable not found or not executable" echo "matrix-timing-tests executable not found or not executable"
exit 1 exit 1
fi fi
- name: Compare timing results - name: Compare timing results
id: check_diff id: check_diff
run: | run: |
# Ensure the previous version exists (from git)
git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt
cp unit-tests/timing-results/matrix-timing-tests.txt new.txt cp unit-tests/timing-results/matrix-timing-tests.txt new.txt
echo "Comparing timing results..." echo "Comparing timing results for changes ≥ 0.1s (ignoring 'Timing Tests' lines)..."
CHANGED=0 changed=0
awk '
BEGIN { change_threshold=0.1 } awk -v changed_ref=/tmp/timings_changed.flag '
/^[0-9]+\.[0-9]+ s: / { BEGIN {
new_time = $1 change_threshold = 0.1
}
FILENAME == "old.txt" && /^[0-9]+\.[0-9]+ s: / {
label = substr($0, index($0, ":") + 2) label = substr($0, index($0, ":") + 2)
if (label_times[label]) { if (label != "Timing Tests") {
old_time = label_times[label] label_times[label] = $1
delta = new_time - old_time
if (delta < 0) delta = -delta
if (delta >= change_threshold) {
changed = 1
}
} else {
changed = 1
} }
} }
FILENAME=="old.txt" && /^[0-9]+\.[0-9]+ s: / { FILENAME == "new.txt" && /^[0-9]+\.[0-9]+ s: / {
new_time = $1
label = substr($0, index($0, ":") + 2) label = substr($0, index($0, ":") + 2)
label_times[label] = $1 if (label == "Timing Tests") next
old_time = label_times[label]
delta = new_time - old_time
if (delta < 0) delta = -delta
if (old_time != "" && delta >= change_threshold) {
printf "⚠️ %.3f s → %.3f s: %s (Δ=%.3f s)\n", old_time, new_time, label, delta
system("touch " changed_ref)
} else if (old_time == "") {
printf "🆕 New timing entry: %.3f s: %s\n", new_time, label
system("touch " changed_ref)
}
} }
END { END {
exit changed == 1 ? 0 : 1 if (!system("test -f " changed_ref)) {
exit 0
} else {
print "✅ Timings havent changed significantly (Δ < 0.1s)."
exit 0
}
} }
' old.txt new.txt ' old.txt new.txt
if [ -f /tmp/timings_changed.flag ]; then
echo "timings_changed=true" >> $GITHUB_OUTPUT
else
echo "timings_changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push timing results - name: Commit and push timing results
if: steps.check_diff.outcome == 'success' && github.event.pull_request.head.repo.full_name == github.repository if: steps.check_diff.outputs.timings_changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
run: | run: |
git config --global user.name "ci-bot" git config --global user.name "ci-bot"
git config --global user.email "ci-bot@local" git config --global user.email "ci-bot@local"
@@ -103,6 +122,6 @@ jobs:
if git diff --quiet --cached; then if git diff --quiet --cached; then
echo "No changes to commit" echo "No changes to commit"
else else
git commit -m "Update matrix-timing-tests timings [skip ci]" git commit -m "Update matrix-timing-tests timings"
git push origin "$BRANCH_NAME" git push origin "$BRANCH_NAME"
fi fi

View File

@@ -1,41 +1,41 @@
Randomness seeded to: 2310772973 Randomness seeded to: 2849118653
0.174 s: Addition 0.176 s: Addition
0.174 s: Timing Tests 0.176 s: Timing Tests
0.169 s: Subtraction 0.177 s: Subtraction
0.169 s: Timing Tests
1.853 s: Multiplication
1.853 s: Timing Tests
0.121 s: Scalar Multiplication
0.121 s: Timing Tests
0.177 s: Element Multiply
0.177 s: Timing Tests 0.177 s: Timing Tests
0.168 s: Element Divide 1.913 s: Multiplication
0.168 s: Timing Tests 1.913 s: Timing Tests
0.150 s: Minor Matrix 0.127 s: Scalar Multiplication
0.150 s: Timing Tests 0.127 s: Timing Tests
0.102 s: Determinant 0.177 s: Element Multiply
0.102 s: Timing Tests 0.178 s: Timing Tests
0.419 s: Matrix of Minors 0.175 s: Element Divide
0.419 s: Timing Tests 0.175 s: Timing Tests
0.110 s: Invert 0.155 s: Minor Matrix
0.110 s: Timing Tests 0.155 s: Timing Tests
0.123 s: Transpose 0.101 s: Determinant
0.123 s: Timing Tests 0.101 s: Timing Tests
0.189 s: Normalize 0.418 s: Matrix of Minors
0.189 s: Timing Tests 0.418 s: Timing Tests
0.112 s: Invert
0.112 s: Timing Tests
0.126 s: Transpose
0.126 s: Timing Tests
0.192 s: Normalize
0.192 s: Timing Tests
0.006 s: GET ROW 0.006 s: GET ROW
0.006 s: Timing Tests 0.006 s: Timing Tests
0.229 s: GET COLUMN 0.240 s: GET COLUMN
0.229 s: Timing Tests 0.240 s: Timing Tests
=============================================================================== ===============================================================================
test cases: 1 | 1 passed test cases: 1 | 1 passed
assertions: - none - assertions: - none -
Command being timed: "build/unit-tests/matrix-timing-tests -d yes" Command being timed: "build/unit-tests/matrix-timing-tests -d yes"
User time (seconds): 3.98 User time (seconds): 4.09
System time (seconds): 0.00 System time (seconds): 0.00
Percent of CPU this job got: 99% Percent of CPU this job got: 100%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.99 Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.09
Average shared text size (kbytes): 0 Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0 Average unshared data size (kbytes): 0
Average stack size (kbytes): 0 Average stack size (kbytes): 0
@@ -45,7 +45,7 @@ assertions: - none -
Major (requiring I/O) page faults: 184 Major (requiring I/O) page faults: 184
Minor (reclaiming a frame) page faults: 172 Minor (reclaiming a frame) page faults: 172
Voluntary context switches: 1 Voluntary context switches: 1
Involuntary context switches: 10 Involuntary context switches: 18
Swaps: 0 Swaps: 0
File system inputs: 12 File system inputs: 12
File system outputs: 1 File system outputs: 1