Reuse compiler signatures and runtime CMIs in OCaml rewatch - #8673
fhammerschmidt wants to merge 3 commits into
Conversation
Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
|
The implemented change caches the expanded WebAPI signature in memory for each Rewatch compiler worker. A worker reuses it across requests after checking that the source CMI files are unchanged and the previous request left the cached graph clean. It prepares the cache only when multiple requests need the signature. In the benchmark, the eight-worker clean build became about 12% faster (1.45 → 1.27 seconds), while peak memory rose from 349 → 523 MiB. Small incremental builds stayed around 0.09 seconds, and the compared outputs were identical. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## faster-rewatch-ocaml-followup #8673 +/- ##
=================================================================
- Coverage 78.69% 78.27% -0.43%
=================================================================
Files 481 481
Lines 65183 65663 +480
=================================================================
+ Hits 51296 51396 +100
- Misses 13887 14267 +380
🚀 New features to boost your workflow:
|
Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
|
After the last commit (5d68298) the eight-worker clean-build median fell from 1,199 ms to 1,014 ms—185 ms faster, or 15%. All 11 paired runs were faster. Unchanged and single-edit builds were effectively unchanged (about 44–45 ms). |
|
Superseded by consolidated PR #8680, which preserves this work as one commit in the combined review branch. |
Summary
StdlibandPervasivesinterfaces within each worker, with load-path and file checks before each hit. Share one immutable prepared signature image across workers while keeping mutable graphs private to each domain.Performance
The initial per-worker expanded signature cache reduced median clean-build time from 1.45 s to 1.27 s in six interleaved eight-worker pairs on the isolated testrepo fixture, while median peak RSS rose from 349 MiB to 523 MiB.
In a later eleven-pair release-profile comparison against that initial cache, the runtime CMI and shared-image changes reduced median clean-build time from 1,199 ms to 1,014 ms (15%). Median sampled peak process-tree RSS fell from 545,312 KiB to 457,660 KiB. Both builds made identical compiler requests, and generated artifact bytes matched. These figures are specific to the test fixture and host.
Stack
Depends on #8672. This PR is the next performance experiment above the compiler tracing work.
Validation
make checkformatmake testmake test-rewatch