3 ms·
This is how Task.js functions https://github.com/icodeforlove/task.js https://github.com/icodeforlove/task.js Which works on Node.js, and the browser. (Suppor
by ic4l 7y ago
This is how Task.js functions
https://github.com/icodeforlove/task.js https://github.com/icodeforlove/task.js
Which works on Node.js, and the browser. (Supports fork, worker_threads, and WebWorkers)
The advantage of this is that the workers become generic enough to run anything. Instead of having to have many "specialized" workers.
Performance-wise eval is not slow, and it is encapsulated inside of the actual worker. Obviously you don't want a user to be able to control any input. But for most cases we are talking about code related to processing, which involves hard coded functions, and the "external-data" being ArrayBuffers.