bytecodealliance / ComponentizeJS

JS -> WebAssembly Component
Apache License 2.0
242 stars 32 forks source link

Dynamic Linking of SpiderMonkey Interpreter #66

Open royaljain opened 1 year ago

royaljain commented 1 year ago

Problem

The size of wasm module produced is quite high, ~ 8 MB for a function adding two numbers. My understanding is that the interpreter (SpiderMonkey) is the majority of it.

Query

Is there a way to dynamically link the interpreter and wasm module to reduce the module size? The primary benefit is when there are multiple wasm modules & instances

For reference: Javy has -d flag for enabling dynamic linking

guybedford commented 1 year ago

Yes this remains a goal for this project, where the engine itself can be imported as a core module that can be dynamically linked.

This work is not currently being prioritised for a while yet, unless someone wants to pick it up.

royaljain commented 1 year ago

Got it.

Is this connected to the component model, will the linking be done through that?

maxbrunsfeld commented 1 week ago

I just ran into this as well. I'm seeing componentize() produce a 10MB binary when I give it a module with nothing but empty stub functions for my world.