Link twice with EXPORTED_FUNCTIONS='@exported_list.txt' #2016
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For the statically linked extension build path, this should be basically irrelevant, moving from inlined list of functions in lib/CMakeLists.txt to a file hosting the list, now at lib/base_exported_list.txt.
For the loadable extension path, the more interesting, this move to a two step linking process:
-s MAIN_MODULE=1
, this means there is limited pruning of functions, but on the other side this means the built WebAssembly module will offer the duckdb-functionality, skipping the needs to duplicate that in each extension-s MAIN_MODULE=2
and-s EXPORTED_FUNCTIONS=@exported_list.txt
.MAIN_MODULE=2
means more aggressive dead code elimination is now perfomed, but keeping intact the list exported at the WebAssembly level (so that say the v-table for all relevant class is not actually pruned)This works around some limitation in current tooling, and allows to bring in specific informations that are otherwise not propagated.
Result should be moving the on-the-wire (=compressed) size of duckdb-wasm from 7.2 MB of Wasm and 384 KB of JS to X MB of Wasm and Y of JS.
There is a follow up planned to further reduce via splitting the main duckdb-wasm module in two parts, but that's for the follow-up.