You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the performance of the libzim version of kiwix-js is worse than the plain javascript version, although the ZIM accesses are much faster with libzim (compiled in wasm).
After adding some timers in the code, we found that it comes from the fact that the WebWorker requested by the emscripten build is mono-threaded : all calls are enqueued and handled one after the other one.
There is almost no overhead of copying the Array in the WebWorker (to have a transferable object).
I currently don't see any other idea than using a pool of WebWorkers instead of only one. It would increase the memory usage because each one would hold its own instance of libzim (with its own cache etc). I don't see how to have a single instance of libzim shared among several WebWorkers for now
We might technically use the libzim directly in the ServiceWorker, instead of a WebWorker. But we can't access the files from the ServiceWorker
The text was updated successfully, but these errors were encountered:
Yes, it's the "same" issue (sort of) that I've been struggling with in openzim/javascript-libzim#42. The problem is that mossroy's suggestion of a pool of Web workers won't help with the issue I identified there, i.e. that the file takes a very long time to load on (probably) ARM-based systems, or on systems with slow I/O. Closing in favour of that issue, but will copy mossroy's comment there.
Currently, the performance of the libzim version of kiwix-js is worse than the plain javascript version, although the ZIM accesses are much faster with libzim (compiled in wasm).
After adding some timers in the code, we found that it comes from the fact that the WebWorker requested by the emscripten build is mono-threaded : all calls are enqueued and handled one after the other one.
There is almost no overhead of copying the Array in the WebWorker (to have a transferable object).
I currently don't see any other idea than using a pool of WebWorkers instead of only one. It would increase the memory usage because each one would hold its own instance of libzim (with its own cache etc). I don't see how to have a single instance of libzim shared among several WebWorkers for now
We might technically use the libzim directly in the ServiceWorker, instead of a WebWorker. But we can't access the files from the ServiceWorker
The text was updated successfully, but these errors were encountered: