According to the Calls between JavaScript and WebAssembly are finally fast article:
calls between JS and WebAssembly are faster than non-inlined JS to JS function calls.
At the same time, as the WebAssembly Concepts article states:
By itself, WebAssembly cannot currently directly access the DOM; it can only call JavaScript, passing in integer and floating point primitive data types. Thus, to access any Web API, WebAssembly needs to call out to JavaScript, which then makes the Web API call.
That means in most cases to access DOM from WASM two function calls are needed: first - to call a bridging JS function from WASM, second - to call an actual DOM-manipulating function from the bridging JS function.
Do I understand it correctly that until these functions are not inlined somehow (so there is only one function call instead of two), there should be a super small performance downgrade while manipulating DOM from WASM?
Are there any actual benchmarks showing the difference in the performance between direct JS and JS-from-WASM DOM manipulations?
Is it reasonable to use WASM for the entire web application (not only for computation-intensive parts) if it's mostly about only DOM manipulations?