Repository navigation
js-tokens: Use explicit source preload - #270
camillobruni wants to merge 2 commits into
Conversation
✅ Deploy Preview for webkit-jetstream-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I actually mis-mesured since I was doing this on the command line instead of the browser where we actually the full external string implementation: Before (10 runs): After (10 runs): |
| async init() { | ||
| this.jsTokensSourceCode = await JetStream.getString(JetStream.preload.JS_SOURCE); | ||
| } |
There was a problem hiding this comment.
Seems like we should just eval the source code here to inject jsTokensWrapperFunction into the global namespace. That way we can delete the code above and have a single source of truth for the wrapper function and we don't run the risk of the two diverging in the future.
Maybe this needs double checking for spidermonkey? |
|
Double-checking locally, the speedup seems accurate for SM. The old approach used EDIT: But that is specific to the shell. The browser implementation might actually be flipped, with the old code getting 1-byte strings and the new code getting 2-byte strings. Are the browser numbers above still accurate? |
Using the function source is technically not defined to always return the source string.
Additionally this forces chrome to use a special external string type since it's rather uncommon to access the function source.
Until we can fix the resource loading to handle duplicate entries for files and preload data we will duplicate the js-tokens.js file to get a separate name.
Addresses issue #271.