Skip to content

Tests: a precompiled header for the test executable - #224

Merged
revarbat merged 1 commit into
mainfrom
build/test-pch
Sep 30, 2026
Merged

revarbat merged 1 commit into
mainfrom
build/test-pch

Conversation

@revarbat

@revarbat revarbat commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

All 35 test files include gtest, and 28 include evaluator.hpp. Header parsing is 40–52% of a test file's compile (clang, measured by compiling each file against a headers-only copy of itself). This adds one target_precompile_headers for oscad_eval_tests, covering gtest, evaluator.hpp, the parser API and the shared std headers.

Local measurement (clang, macOS, the test executable's objects rebuilt at -j 4):

Wall CPU
Before 26.6, 26.7 s 90.5, 91.9 s
After 24.8, 26.2 s 70.8, 74.8 s

That's ~20% less CPU but only 2–7% less wall time: the PCH compiles before any test file can start, and the end of the build is dominated by the largest test files.

CI result: small but consistent on Windows, three runs paired against #222's three runs (/MP only):

CI run Windows, /MP Windows, /MP + PCH Change
1st 511 s 460 s −10%
2nd 499 s 462 s −7%
3rd 353 s 322 s −9%

That's ~40 s off each Windows CI build. Linux and macOS are within their run-to-run noise. Release wheels don't build the tests, so they're unaffected.

The trade-off: a test file that forgets one of the precompiled includes still compiles here. That only affects test code.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@revarbat
revarbat marked this pull request as ready for review September 30, 2026 15:59
@revarbat
revarbat merged commit 2afcb66 into main Sep 30, 2026
9 checks passed
@revarbat
revarbat deleted the build/test-pch branch September 30, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant