Enable strip_source when compiling to bytecode - #1242
Draft
jeffcharles wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
Enable
strip_sourcewhen compiling JS source code to QuickJS bytecode. Whenstrip_sourceis disabled (the default behaviour), a copy of the source code is included in the QuickJS bytecode. The source code is used for operations likefunction.prototype.toString(). I don't think this should impact profiling.I've also added some automated tests to ensure the Wasm modules don't increase in size too much. I'm happy to tweak the percentage threshold.
This is still a draft while I figure out if I need to bump the plugin version.
Why am I making this change?
We observed that the size of the QuickJS bytecode for the same source code was often substantially larger than with the previously released version of Javy. I've observed it being 30% to 70% larger on real-world test cases I've given it and I've seen one reported case I haven't verified where the bytecode size quadrupled. It looks like this was related to changing to quickjs-ng where it started to default to including source code in the bytecode](quickjs-ng/quickjs#218).
Checklist
javy-plugin-apiif the QuickJS bytecode has changed.javy-cli,javy-plugin, andjavy-plugin-processingdo not require updating CHANGELOG files.