-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Support --preload-file in the shell environment and d8 #15337
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
Nice! Thank you, can confirm the compile is really fast now, and also the polyfill works with d8. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to LGTM.
We already have a helper function called IIRC that hard part of allowing file package to run both with and without the emscripten glue code.. but maybe file_packager can use |
Yes, the problem is the file packager code is separate. It can't depend on (Note that I don't think polyfilling a web API is that bad. In fact, it makes the code simpler: all the code uses the Web API, and the polyfill is the one place that has special code for d8. That is the approach suggested in #12203. In comparison the node support in the file packager atm depends on having special node code in that file.) |
If the file packager output is designed to run before the emscripten code arrives.. then how would this polyfil work.. since the polyfill itself lives in the emscripten code? |
Ah, good point... it won't work in totally separate output, you're right. It does work in |
Thats what I man. Is file_packer aware when its running in |
@@ -43,6 +43,10 @@ var Module = typeof {{{ EXPORT_NAME }}} !== 'undefined' ? {{{ EXPORT_NAME }}} : | |||
#include "promise_polyfill.js" | |||
#endif | |||
|
|||
#if ENVIRONMENT_MAY_BE_SHELL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, how about an internal settings called INCLUDE_XHR_POLYFILL
which can be set when the file packager is used? Then we can avoid this unless is needed?
Thinking more on this, when the new FS is ready we should be able to embed files entirely in C. That would avoid this issues that led to this PR, as it would be easy and efficient. So let's close this, which would only help the old FS. |
This does so using a polyfill for XHR. That has downsides, but the shell
environment is only really used for local testing, so that seems ok.
Other options to fix the general issue of embed-file being slow on huge
files is to optimize embed-file's output. However, testing of emitting the
base64-encoded data in chunks is inconclusive: faster to parse in our
JS optimizer but slower in closure.