-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Inline pthread worker.js file into the main output file #21701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
50b906f
to
5691c6f
Compare
256a82f
to
23f46b0
Compare
Would you consider doing this for wasm workers and audio worklets? Also, if this has many advantages, I would suggest making this the default, while keeping option to NOT embed the wasm file, for reduced size, module caching and stuff. |
Absolutely! One step a time though. Getting pthreads done first because it probably most used (and likely the hardest to get working) so a good proof of concept. |
What about this being default and wasm file embedding? What do you think? We can make another setting called EMBED_WASM |
My plan is to make this not only the default, but the only option. I don't see any reason at this point to keep the old method around. Don't we already have |
SINGLE_FILE seems to mean embed everything into one file, not just the wasm, I think we should have another name for embedding or separate the wasm since this can be quite misleading |
But if we remove the separate worker files, what other file are there? Another way of putting it: What files would you not want to embed when you use |
You're right, my mistake. But should we just rename the settings anyway? I'm really excited for this to land ngl |
Doesn't |
We should use a global switch statement for this? For simplicity I suggest just doing |
Rather than using a query string (which may complicate caching), can you use the name option? Only potential issue I can see is that it's not supported in Android Webview, but I'm not sure if that's a supported browser. |
Sure we can try that. Can you explain what you mean by "may complicate caching"?
|
Just that many caches may distinguish query strings. It may not be added to service worker caches either. I was thinking of a case where you add all the files in a service worker for offline use, but then it fails because of the query string. If someone was using a service worker they could work around that though. But it might be more predictable to avoid it possible. I don't know that the name property is a viable alternative however. |
Are you saying that adding the query string would mean that the file would not cached at all, or that maybe we would end up with two seperate cache entries (one for the |
We stopped using a separate worker file back in #21701. That was released in 3.1.58 back in April. This change ends the transition period by no longer generating a dummy/useless worker.js file alongside the output.
These were introduced in emscripten-core#21701 but were never used.
These were introduced in emscripten-core#21701 but were never used.
These were introduced in #21701 but were never used.
…#22908) These were introduced in emscripten-core#21701 but were never used.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Back in emscripten-core#21701 I broke move the creation of wasmOffsetConvert and wasmOffset into runtime_pthread.js but I didn't update libwasm_worker.js which still uses the old name `wasmOffsetData` in its initial post message. When trying to update this just now I noticed that the offset converter (and santiizers in general) don't seem to work on WASM_WORKERS so this change simply disables them.
Back in emscripten-core#21701 I broke move the creation of wasmOffsetConvert and wasmOffset into runtime_pthread.js but I didn't update libwasm_worker.js which still uses the old name `wasmOffsetData` in its initial post message. When trying to update this just now I noticed that the offset converter (and santiizers in general) don't seem to work on WASM_WORKERS so this change simply disables them.
Back in #21701 I moved the creation of wasmOffsetConvert and wasmOffset into runtime_pthread.js but I didn't update libwasm_worker.js which still uses the old name `wasmOffsetData` in its initial post message. When trying to update this just now I noticed that the offset converter (and santiizers in general) don't seem to work on `WASM_WORKERS` so this change simply disables them. The passing of `wasmOffsetData` and `wasmSourceMapData` was added back in #20188 but it doesn't looks like support for santizers was supposed to be part of that.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
Similar to what we did for pthreads in emscripten-core#21701. This is win for both code size and complexity.
This method has many advantages over the previous method of generating a separate file:
-sSINGLE_FILE
now works with pthreadsThe test_pthread_custom_pthread_main_url test was completely removed
since it was testing how worker.js was located and worker.js no longer
exists.
Fixes: #9796