Closed mfbx9da4 closed 2 years ago
You've got the cost to start up a new JS VM, parse the additional source code (+ parse the RN source code again), send the contents from your main JS process to the new one, and send it back.
Can you not use native code to do the decryption?
Yep that's what I went with
Is there a one off cost to constructing the new JS VM? ie is the worker re-used for subsequent calls?
Yeah, the worker is created every time you do new Thread
. Then any postMessage
calls re-use it. It only gets removed if you explicitly call thread.terminate()
. The cost is pretty huge to create the worker though (enough to justify Facebook building the Hermes JS engine)
I'm using this library to do some JS blocking file decryption on a worker process. This library works great to free up the main thread but the actual decryption time seems to be about 10x slower than doing the same decryption on the main JS process. Is the worker process somehow resource constrained? Why might this be?
Tested on iOS 15 in the simulator.