Skip to content

Pre-generate DynamicScope shapes at build time#5761

Merged
headius merged 1 commit intojruby:masterfrom
headius:pregen_dynscope
Jun 7, 2019
Merged

Pre-generate DynamicScope shapes at build time#5761
headius merged 1 commit intojruby:masterfrom
headius:pregen_dynscope

Conversation

@headius
Copy link
Member

@headius headius commented Jun 4, 2019

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).

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.
@headius headius added this to the JRuby 9.2.8.0 milestone Jun 4, 2019
@headius headius requested review from enebo and kares June 4, 2019 22:54
@headius headius merged commit 164a621 into jruby:master Jun 7, 2019
@headius headius deleted the pregen_dynscope branch June 7, 2019 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants