Task
Make binaryan.py an integral part of the icpp-pro build pipeline for wasm. Install it as a dependency and always execute it.
Description
The IC has a limit on the number of globals in a wasm file. If this limit is exceeded, the wasm can't be deployed.
It turns out that the ifstream, ofstream and filesystem commands of the C++ standard library generate thousands of globals that prevent a wasm from being deployed.
The binaryan.py package is a wrapper around the C++ binaryan library that can optimize a wasm file, and one of the optimizations is to remove unused globals. It literally removes them all, and we end up with only 1 global.
This was a very important discovery while working on llama_cpp_canister, where we currently use binaryan.py in a post wasm customization module to reduce the number of globals from thousands to one. Without this it would not be possible to deploy the llama_cpp_canister wasm module to the IC.
Task
Make binaryan.py an integral part of the icpp-pro build pipeline for wasm. Install it as a dependency and always execute it.
Description
The IC has a limit on the number of globals in a wasm file. If this limit is exceeded, the wasm can't be deployed.
It turns out that the ifstream, ofstream and filesystem commands of the C++ standard library generate thousands of globals that prevent a wasm from being deployed.
The binaryan.py package is a wrapper around the C++ binaryan library that can optimize a wasm file, and one of the optimizations is to remove unused globals. It literally removes them all, and we end up with only 1 global.
This was a very important discovery while working on llama_cpp_canister, where we currently use binaryan.py in a post wasm customization module to reduce the number of globals from thousands to one. Without this it would not be possible to deploy the llama_cpp_canister wasm module to the IC.