High CPU usage in WebAssembly when initialized

  c++, cpu-usage, javascript, webassembly

I am implementing an app with backend in WebAssembly. My WebAssembly code is loaded into web workers. The size of wasm file is 3.5MB. In the backend code we are initializing big objects. When starting an app for some period of time (around 1 minute) the CPU usage is aronud 200-300% and after that decreases to 5-10% because we are using 4 web workers. Additionally, when reloading an app with F5 the CPU usage is around 300-400% (probably because of garbage collector working in background?). Is there any workaround or solution to this issue or is this webassembly internal problem? Does the .wasm file size matter or its structure when implementing web workers?

Source: Windows Questions C++

LEAVE A COMMENT