threadify
threadify copied to clipboard
Performance concern on initialize web worker at every function wrapped by threadify
This is more like a thought or possible enhancement. From what I understand, web workers are designed to be slow start and long running. I read an article saying it usually takes around 40 ms to initialize a web worker, which is way over 17ms and may cause lagging in UI.
https://hacks.mozilla.org/2015/07/how-fast-are-web-workers/
I think maybe there should be a way to share the worker and create new ones only when necessary.
You are right,
I planned to implement a pool of worker and sending them tasks instead of always starting new workers... but I never done it by lack of time...
Maybe I will implement this when I will have some free time :)