Move header-only C++ runtime to dedicated runtime library - #103
Pennnnnnnny wants to merge 18 commits into
Conversation
…rcular dependencies
b23daa3 to
adf7bd5
Compare
97ea5f9 to
edf2778
Compare
Compilation-time benchmarkI tested the generated C++ compilation time before and after the pre-built GenWasm runtime refactor. The benchmark compares:
For each test case, I measured the direct I tested both
|
| Test case | Header-only lib | Pre-built lib |
|---|---|---|
| small-snapshot-concrete | 7.23 s | 5.793 s |
| large-branch-concrete | 2.91 s | 1.493 s |
| fib - concrete | 2.66 s | 1.373 s |
| fact - concrete | 2.63 s | 1.337 s |
| ack-cpp - concrete | 2.92 s | 1.363 s |
-O3
| Test case | Header-only lib | Pre-built lib |
|---|---|---|
| small-snapshot-concrete | 385.923 s | 100.777 s |
| large-branch-concrete | 6.200 s | 4.727 s |
| fib - concrete | 5.863 s | 2.963 s |
| fact - concrete | 5.263 s | 2.883 s |
| ack-cpp - concrete | 5.327 s | 2.937 s |
Across the controlled test cases, I did not observe a compilation-time regression after moving the runtime to the pre-built library. The pre-built runtime reduced generated C++ compile/link time in all tested cases, with the largest improvement appearing for the large small-snapshot-concrete workload under -O3.
Note: fact - concrete generated different C++ between the header-only and pre-built versions, so its timing is included for completeness.
I attached the benchmark script below so the same comparison can be reproduced:
benchmark_genwasym_compile.sh
|
Thanks @Pennnnnnnny and @butterunderflow! This looks like a good improvement in compilation time, can you also list the size of these C++ files as well as the number of C++ files? Another thing I noticed is that the headers still include some |
|
It would be good to also separate interfaces for the generated code, and interfaces for the runtime itself, so that we can minimize the header exposed to the generated code. For example, in GenSym, the former is quite a compact header file https://github.com/Generative-Program-Analysis/GenSym/blob/main/headers/gensym/runtime.hpp, which doesn't rely on immer, and the header for the runtime is https://github.com/Generative-Program-Analysis/GenSym/blob/main/headers/gensym.hpp, which includes everything that used to be in the monolithic header. |
This PR adds the initial genwasym_runtime structure and includes some current runtime-related changes.
Main changes: