How to optimize WASM build #1546
Replies: 3 comments 27 replies
-
|
Have you looked through the suggestions at https://www.google.com/search?q=compile+js+to+wasm (Javy, Porffor, or switching to AssemblyScript)? It seems like you're trying to reimplement Javy. |
Beta Was this translation helpful? Give feedback.
-
You can remove the repl, standalone support, and trim the libc to a minimum (just WASI supports for example). As for injecting the JS, if you want the absolute smallest you could bytecompile and compress it on the host, and uncompress and eval the bytecode in wasm. Since you'll need some code to do de decompression that might not be worth it though. |
Beta Was this translation helpful? Give feedback.
-
|
I'm not sure of your exact use case (i.e. if you need a full I just did a pass of file size optimizations based on this discussion (vercel-labs/quickjs-wasi#17) and the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been playing around with compiling QuickJS-NG to WASM. I commented a bunch of lines in
qjs.cso that when executedqjs(qjs-wasi.wasmfromrelease.yml)quickjs/.github/workflows/release.yml
Lines 131 to 133 in 0d085ed
evaluates the JavaScript embedded in
qjs.c. Afterwasm-optI get the resulting WASM down to around 969.1 KiB. Right now I'm jus usingbun build --minifyon the JavaScript I intend to embed and copy/pasting that code inqjs.c.Now I have two questions:
qjs.c, what else can I remove from the build to get a bare metal (smallest build possible)qjs?qjs.c?qjs.c
Beta Was this translation helpful? Give feedback.
All reactions