Note: I ran each of the timed runs multiple times but picked the lowest number of each
Generate ~/.ir fresh:
time echo exit | CLASSPATH=/home/enebo/.ir JRUBY_OPTS="-Xcompile.cache.classes=true -J-XX:+UseParallelGC" jruby -X+C -S rails c
Notice it is not in JRUBY_OPTS so second spawn of Rails will not compile. This will only generate 134 files in ~/.ir
Now run with cache on:
% time echo exit | CLASSPATH=/home/enebo/.ir JRUBY_OPTS="-Xcompile.cache.classes=true --dev -J-XX:+UseParallelGC" jruby -S rails c
real 0m12.186s
user 0m15.310s
sys 0m1.235s
And off:
time echo exit | CLASSPATH=/home/enebo/.ir JRUBY_OPTS="-Xcompile.cache.classes=false --dev -J-XX:+UseParallelGC" jruby -S rails c
real 0m14.435s
user 0m17.343s
sys 0m1.228s
Generate ~/.ir fresh:
time echo exit | CLASSPATH=/home/enebo/.ir JRUBY_OPTS="-Xcompile.cache.classes=true -X+C -J-XX:+UseParallelGC" jruby -S rails c
With cache on:
% time echo exit | CLASSPATH=/home/enebo/.ir JRUBY_OPTS="-Xcompile.cache.classes=true --dev -J-XX:+UseParallelGC" jruby -S rails c
real 0m14.322s
user 0m17.854s
sys 0m1.250s
With cache off:
time echo exit | CLASSPATH=/home/enebo/.ir JRUBY_OPTS="-Xcompile.cache.classes=false --dev -J-XX:+UseParallelGC" jruby -S rails c
real 0m14.409s
user 0m17.330s
sys 0m1.125s
We can see cache off should be the same speed and it is pretty much but with cache on only loading those first 134 files seems like a much larger win. To me, this implies two possible outcomes:
- loading everything as bytecode is slower than parse + interp
- some jitting is helping speed up startup because it warms quicker