-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
Currently when building the USE_PTHREADS Emscripten creates a separate module.worker js file.
This is loaded from module.js like:
var pthreadMainJs = "module.worker.js";
pthreadMainJs = locateFile(pthreadMainJs);
var newWorkers = [];
for (var i = 0; i < numWorkers; ++i) {
newWorkers.push(new Worker(pthreadMainJs));
}
It is also possible to create an inline webworker, doing something like:
let workerBlob = new Blob(['string_containing_minified_module.worker.js'], type:"application/javascript"});
pthreadMainJs = URL.createObjectURL(workerBlob);
var newWorkers = [];
for (var i = 0; i < numWorkers; ++i) {
newWorkers.push(new Worker(pthreadMainJs));
}
I imagine that it would be simple enough to minify module.worker.js, then embed that into the main module.js.
I believe that this will speed up loading threads, and should also make webpacking pthreads builds easier/possible.
Username404-59, Glavin001 and haxiomic
Metadata
Metadata
Assignees
Labels
No labels