4 ms·
I would guess a lot of the overhead would be thunking back and forth between webasm and js functions, so if you implemented the update in pure js where it can c
by DonHopkins 10y ago
I would guess a lot of the overhead would be thunking back and forth between webasm and js functions, so if you implemented the update in pure js where it can call directly into the DOM apis, and also read pointers, numbers and strings directly out of the webasm data array, then you could avoid any thunking between the two different worlds in the inner loop.
By thunking I mean doing this from C++ code:
EM_ASM_({
window['asmDomHelpers']['domApi']['appendChild']($0, $1);
}, vnode->elm, createElm(vnode->children[i]));
- oever 10y agoSo you propose to interface between C++ and JavaScript via a shared buffer and to eschew any explicit FFI calls. If the data structure is lockless, that is doable.