Skip to content
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

Optimize wasm file #95

Open
etrombly opened this issue Apr 25, 2024 · 3 comments
Open

Optimize wasm file #95

etrombly opened this issue Apr 25, 2024 · 3 comments

Comments

@etrombly
Copy link

Stripping the debug symbols and optimizing with wasm-opt cuts lg2.wasm down from 6.3Mb to 1.1Mb, and seems to execute a little faster (only minimally tested). May want to see if you can do the same thing for the packaged version.

wasm-opt --strip-debug -O3 emscriptenbuild/libgit2/examples/lg2.wasm -o emscriptenbuild/libgit2/examples/lg2-stripped.wasm
@petersalomonsen
Copy link
Owner

If you look at the latest released version of wasm-git then lg2.wasm is 803KB: https://www.jsdelivr.com/package/npm/wasm-git?tab=files

@etrombly
Copy link
Author

That was based on using build.sh to build a local copy (I had also pulled in v1.7.2 of libgit2). Are you doing additional steps for packaging after that? May just want to mention in the build instructions how to optimize the wasm output.

@petersalomonsen
Copy link
Owner

If you run build.sh Release you should get the optimized version. You can also see how the release pipeline does this here: https://github.com/petersalomonsen/wasm-git/blob/master/.github/workflows/publish.yml#L28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants