There are a bunch of tools we could run over the object files in wheels for this, but wasm-opt and wasm-dce come up in search results in the first go. I don't know enough about how to do this, so I'm documenting some resources here for our reference.
Otherwise, I'm sure we are building everything in release mode, LTO, etc. and use only the required amount of INITIAL_MEMORY already. Build backends are not always responsible for stripping away binary information, and while some do support calling strip over the .so files (scikit-build-core, for one), I don't know if they are aware of Emscripten-specific tools for this.
Other ways to reduce binary size at build time (install tags, better support build backend tooling, etc.) are best covered in pyodide-build, not here – we are concerned about what happens after build time.
There are a bunch of tools we could run over the object files in wheels for this, but
wasm-optandwasm-dcecome up in search results in the first go. I don't know enough about how to do this, so I'm documenting some resources here for our reference.Otherwise, I'm sure we are building everything in release mode, LTO, etc. and use only the required amount of
INITIAL_MEMORYalready. Build backends are not always responsible for stripping away binary information, and while some do support callingstripover the.sofiles (scikit-build-core, for one), I don't know if they are aware of Emscripten-specific tools for this.Other ways to reduce binary size at build time (install tags, better support build backend tooling, etc.) are best covered in
pyodide-build, not here – we are concerned about what happens after build time.