Build: each of the 478 AGC execution test objects parses the same header set again #10163

Closed
opened 2026-10-23 11:34:43 +00:00 by LeandroLP23 · 0 comments
LeandroLP23 commented 2026-10-23 11:34:43 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-23T11:34:43Z.


The 478 AGC execution tests (core/libs/prx/libSceAgcDriver/tests/execution/*.cpp, one executable each) spend most of their compile time parsing the same headers. 463 of the 478 sources include VulkanTestDevice.hpp, which brings in VulkanDevice.hpp, Draw.hpp, Recompiler.hpp and about 35 more project headers. So editing almost any libSceAgcDriver header recompiles all of them, and each one parses that set again.

Measurement. Ryzen AI 7 350, Windows 11, WinLibs GCC 15.2, Release, BUILD_TESTING=ON, main d339082d2e.

Five sources taken at even intervals from the build's target list, each compiled alone with the exact command ninja uses, on an idle machine:

Source -fsyntax-only (parse only) -O3 (the build)
AddressPasses.cpp 4.6 s 3.7 s
DccKeysFirstWrite.cpp 2.6 s 4.1 s
FailedCaptureDump.cpp 2.6 s 2.7 s
ImagePlaneCompareOnLine.cpp 2.1 s 2.4 s
PartiallyResidentSnapshot.cpp 2.5 s 4.1 s

Parsing is 60 to 100% of each compile. Code generation is a small part, and -O1 is no faster.

Where the time goes on a header edit. Touching tests/execution/VulkanTestDevice.hpp and rebuilding the execution test objects, with ccache disabled, at -j 4: 463 compiles, 664 s.

Restructuring the includes doesn't fix it. I modelled the include graph of core/ and checked it against ninja -t deps: it gives 583 dependents of State.hpp where ninja reports 581. Suppose VulkanDevice.hpp, Driver/Driver.hpp, VulkanTestDevice.hpp, Resources.hpp and ShaderResources.hpp all stopped including what leads to the Graphics headers. The translation units that recompile after an edit would still only drop 17 to 28%: State.hpp 583 to 419, Texture.hpp 558 to 427, Draw.hpp 534 to 386. The tests include those headers themselves (Draw.hpp directly from 373 sources), and making the five headers stop would touch hundreds of files many open PRs also edit. #10125 has the details.

Proposal. One precompiled header shared by the execution tests. They are defined in a single loop with the same options, so the first one builds the PCH and the rest reuse it (target_precompile_headers(... REUSE_FROM ...)). Its contents are VulkanTestDevice.hpp and the five standard headers most of them include. It changes no source file. With ccache as the launcher, these targets also set CCACHE_SLOPPINESS=pch_defines,time_macros, which ccache requires to cache objects built with a PCH. Without it, every one of them would miss.

#10164 implements it.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5997006977 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/10163). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-23T11:34:43Z. --- The 478 AGC execution tests (`core/libs/prx/libSceAgcDriver/tests/execution/*.cpp`, one executable each) spend most of their compile time parsing the same headers. 463 of the 478 sources include `VulkanTestDevice.hpp`, which brings in `VulkanDevice.hpp`, `Draw.hpp`, `Recompiler.hpp` and about 35 more project headers. So editing almost any `libSceAgcDriver` header recompiles all of them, and each one parses that set again. **Measurement.** Ryzen AI 7 350, Windows 11, WinLibs GCC 15.2, Release, `BUILD_TESTING=ON`, `main` `d339082d2e`. Five sources taken at even intervals from the build's target list, each compiled alone with the exact command `ninja` uses, on an idle machine: | Source | `-fsyntax-only` (parse only) | `-O3` (the build) | |---|---|---| | `AddressPasses.cpp` | 4.6 s | 3.7 s | | `DccKeysFirstWrite.cpp` | 2.6 s | 4.1 s | | `FailedCaptureDump.cpp` | 2.6 s | 2.7 s | | `ImagePlaneCompareOnLine.cpp` | 2.1 s | 2.4 s | | `PartiallyResidentSnapshot.cpp` | 2.5 s | 4.1 s | Parsing is 60 to 100% of each compile. Code generation is a small part, and `-O1` is no faster. **Where the time goes on a header edit.** Touching `tests/execution/VulkanTestDevice.hpp` and rebuilding the execution test objects, with ccache disabled, at `-j 4`: 463 compiles, 664 s. **Restructuring the includes doesn't fix it.** I modelled the include graph of `core/` and checked it against `ninja -t deps`: it gives 583 dependents of `State.hpp` where ninja reports 581. Suppose `VulkanDevice.hpp`, `Driver/Driver.hpp`, `VulkanTestDevice.hpp`, `Resources.hpp` and `ShaderResources.hpp` all stopped including what leads to the Graphics headers. The translation units that recompile after an edit would still only drop 17 to 28%: `State.hpp` 583 to 419, `Texture.hpp` 558 to 427, `Draw.hpp` 534 to 386. The tests include those headers themselves (`Draw.hpp` directly from 373 sources), and making the five headers stop would touch hundreds of files many open PRs also edit. #10125 has the details. **Proposal.** One precompiled header shared by the execution tests. They are defined in a single loop with the same options, so the first one builds the PCH and the rest reuse it (`target_precompile_headers(... REUSE_FROM ...)`). Its contents are `VulkanTestDevice.hpp` and the five standard headers most of them include. It changes no source file. With ccache as the launcher, these targets also set `CCACHE_SLOPPINESS=pch_defines,time_macros`, which ccache requires to cache objects built with a PCH. Without it, every one of them would miss. #10164 implements it. AI-assisted: yes (Claude Code)
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#10163
No description provided.