Pre-generate DynamicScope shapes at build time#5761
Merged
headius merged 1 commit intojruby:masterfrom Jun 7, 2019
Merged
Conversation
This avoids generating them at runtime. Currently this is set to pregenerate all sizes which we would have generated at runtime, which currently is set to 50.
enebo
approved these changes
Jun 5, 2019
kares
approved these changes
Jun 5, 2019
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.
This PR pregenerates all DynamicScope subclasses we normally generate at runtime. The classes are included in the JRuby jar file so none of these classes are generated at runtime.
The logic here uses the max generated size as the max to pregenerate, resulting in no runtime generation happening. Currently, we generate up to 50-wide, so this PR currently generates 51 classes into JRuby.jar. Typical Ruby code will use only the smallest sizes, so this may be wasteful. The full set of 51 classes increases the size of my local jruby.jar by about 90k.
We may want to consider pregenerating fewer classes (if the size of the jar is important) as well as possibly generating fewer shapes overall (since there are diminishing returns to create e.g. a 50-wide scope class that's only used for one method).