-
-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary bloat discussion #1627
Comments
-- reserved -- |
Bloaty output from single class extension file, template_release, mach-o format: Symbols, first 100:
Compileunits, first 100:
|
I tried compiling that extension (plus the proper registration, see the attached project) using godot-cpp 4.3 branch ( # emcc --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64 (a1fe3902bf73a3802eae0357d273d0e37ea79898)
# wasm32-clang --version
clang version 19.0.0git (https:/github.com/llvm/llvm-project 4d8e42ea6a89c73f90941fd1b6e899912e31dd34)
Target: wasm32 This resulted in binaries way smaller than the 2MiB mentioned in the OP: # scons platform=web
872K project/bin/libgdexample.web.template_debug.wasm32.wasm
# scons platform=web target=template_release
876K project/bin/libgdexample.web.template_release.wasm32.wasm I also tried building with a dedicated build profile (also attached in the project): # scons platform=web build_profile=build_profile.json
184K project/bin/libgdexample.web.template_debug.wasm32.wasm
# scons platform=web target=template_release build_profile=build_profile.json
184K project/bin/libgdexample.web.template_release.wasm32.wasm This is as much as I can do to test these claims, given you did not provide a full MRP, nor the relevant toolchain information. MRP (to be extracted as godot-cpp subfolder, or you should adjust the godot-cpp include to match the proper location): Note: Reported results are for threads builds, but nothreads results in similar sizes. EDIT: Since in the OP you mentioned godot-cpp 4.4-dev I'm re-running the builds with current Here are the results: Regular:
Profile:
|
@jordo Thanks for creating this issue! Finding ways to reduce the binary size of extensions, especially for the web or mobile, is a worthy goal :-)
A change like this makes sense to me. Something else @Faless and I discussed while we were at GodotCon was the possibility of replacing the function name with a hash. In this case, it probably wouldn't make much difference (if we used |
@Faless Sorry, can you build and post your wasm artifacts with debug symbols? I would like to take a look at the dissasembly for those. Specifically the two you posted at the end of your comment: |
The 2MiB size i mentioned in the OP is a mach-o universal binary, so it includes two architectures. A single architecture build for mach-o or targetting other ASM formats results in a ~1MB file which is similar to what you have posted. |
One thing to notice, is that unlike Godot itself, we don't build with |
Results with Regular:
Build profile:
|
@dsnopek well, nevermind, it seems that the regression is due to #1603 (which is needed), and in fact I can't reproduce it on Linux. I guess emscripten just adds more stuff to handle (u)int64_t via BigInts. |
Godot version
4.4-dev
godot-cpp version
4.4-dev
System information
wasm in particular
Issue description
This is intended to primarily be a tracking issue looking at ways to reduce the binary size of these extension libraries. Intended to be an open discussion to followup on #1621
Steps to reproduce
Compiling the simplest of extensions, a single file single including a single header results in a 2MB library (Reviewer EDIT: macos universal library, i.e. 1MB for each architecture). Example:
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: