Separate compilation for GenWasym runtime - #103
butterunderflow merged 19 commits into
Conversation
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 Generated C++ file counts and sizesThe benchmark script compiles one generated C++ source file per test case, covering 5 source files per version. The same five source paths are used for both optimization levels; repeated compilation runs do not increase the source-file count. The table below lists the sizes of the currently retained generated C++ files in my local pre-built-runtime checkout.
Note: Sizes refer to the generated source files themselves, excluding included headers, preprocessed output, object files, executables, and runtime libraries.
|
| 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. |
…rcular dependencies
f8873bb to
f6afdc8
Compare
76c9d00
into
Generative-Program-Analysis:main
This PR adds the initial genwasym_runtime structure and includes some current runtime-related changes.
Main changes: