| ▲ | nowaymo6237 5 hours ago | |||||||
I’ve played around with webworkers and just could never seem to get over the latency issues | ||||||||
| ▲ | W4G1 4 hours ago | parent [-] | |||||||
Interesting. Are you talking about the latency to spawn new workers, or getting data from the main thread to the worker? To give you an idea, this library uses a lazily initialized thread pool (thread-per-core by default), where tasks are shared between workers (like the Tokio library in Rust). This means workers only need to be initialized once, and passing data via structured clone is usually very fast and optimized in most engines. Better yet is to use ArrayBuffer or SharedArrayBuffer, which can be transferred or shared between threads without any serialization overhead. | ||||||||
| ||||||||