-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi,
Thanks Charles and Tom, now I understood what's going on. https://github.com/headius/jruby/commit/f56610ee6ef01f0421301d9e2941493e9fa4e29d I love JRuby, since I can try a concept of language implementation with small change like this. On 10/26/2011 12:36 AM, Charles Oliver Nutter wrote: > INIT OF JRUBY PLUS -rubygems > > system ~/projects/jruby $ jruby bench/bench_jruby_init.rb 5 > -rubygems user system total real in-process `jruby > -rubygems` 0.193000 0.000000 0.193000 ( 0.177000) user > system total real in-process `jruby -rubygems` > 0.085000 0.000000 0.085000 ( 0.085000) user system > total real in-process `jruby -rubygems` 0.085000 0.000000 > 0.085000 ( 0.085000) user system total real > in-process `jruby -rubygems` 0.071000 0.000000 0.071000 ( > 0.071000) user system total real in-process `jruby > -rubygems` 0.076000 0.000000 0.076000 ( 0.076000) > > ...PLUS require 'activerecord' > > system ~/projects/jruby $ jruby bench/bench_jruby_init.rb 5 > "-rubygems -e \"require 'activerecord'\"" user system > total real in-process `jruby -rubygems -e "require > 'activerecord'"` 0.192000 0.000000 0.192000 ( 0.176000) user > system total real in-process `jruby -rubygems -e > "require 'activerecord'"` 0.087000 0.000000 0.087000 ( > 0.087000) user system total real in-process `jruby > -rubygems -e "require 'activerecord'"` 0.087000 0.000000 > 0.087000 ( 0.087000) user system total real > in-process `jruby -rubygems -e "require 'activerecord'"` 0.069000 > 0.000000 0.069000 ( 0.069000) user system total > real in-process `jruby -rubygems -e "require 'activerecord'"` > 0.078000 0.000000 0.078000 ( 0.078000) IIRC, bench_jruby_init.rb now invokes RubyInstanceConfig#processArguments only, so above "-e" part is not executed. > Note how much startup improves for subsequent runs in the > -rubygems and -r activerecord cases. If it were solely IO-bound, we > wouldn't see that much improvement. Here's a benchmark with active_record. I'm doing on master + benchmark_accuracy branch which utilizes ThreadMXBean for benchmark. % jruby -v jruby 1.7.0.dev (ruby-1.8.7-p330) (2011-10-26 1c99cf2) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_02-ea) [linux-amd64-java] % cat rubygems_with_ar.rb require "rubygems" require "active_record" % JAVA_HOME=/home/nahi/java/jdk1.6.0_26 jruby bench/bench_jruby_init.rb 5 "-rrubygems -e 0" user system total real in-process `jruby -rrubygems -e 0` 0.741000 0.000000 0.741000 ( 0.664000) user system total real in-process `jruby -rrubygems -e 0` 0.524000 0.000000 0.524000 ( 0.524000) user system total real in-process `jruby -rrubygems -e 0` 0.384000 0.000000 0.384000 ( 0.384000) user system total real in-process `jruby -rrubygems -e 0` 0.336000 0.000000 0.336000 ( 0.336000) user system total real in-process `jruby -rrubygems -e 0` 0.255000 0.000000 0.255000 ( 0.255000) % JAVA_HOME=/home/nahi/java/jdk1.6.0_26 jruby bench/bench_jruby_init.rb 5 "-rrubygems_with_ar -e 0" user system total real in-process `jruby -rrubygems_with_ar -e 0` 6.585000 0.000000 6.585000 ( 6.534000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 3.442000 0.000000 3.442000 ( 3.443000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 2.808000 0.000000 2.808000 ( 2.808000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 2.203000 0.000000 2.203000 ( 2.203000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 2.070000 0.000000 2.070000 ( 2.070000) > Startup time issues are a combination of factors: > > * IO, including filesystem searching and the actual read of the > file * Parsing and AST building * JVM being cold; our parser, > interpreter, core classes are all running at their slowest * > Internal caches getting vigorously flushed at boot, since there's > so many methods and constants being created > > My parallelizing patch helps the first three but didn't make a big > difference in actual execution of commands like "rake test" in a > Rails app. I'm going to poke at startup a bit more today and see if > I can figure out how much time in "rake test" is *actually* booting > versus execution. And here's a result of same benchmark with parallel_load (master + f56610ee). % JAVA_HOME=/home/nahi/java/jdk1.6.0_26 jruby bench/bench_jruby_init.rb 5 "-rrubygems -e 0" user system total real in-process `jruby -rrubygems -e 0` 1.833000 0.000000 1.833000 ( 1.770000) user system total real in-process `jruby -rrubygems -e 0` 0.588000 0.000000 0.588000 ( 0.589000) user system total real in-process `jruby -rrubygems -e 0` 0.514000 0.000000 0.514000 ( 0.514000) user system total real in-process `jruby -rrubygems -e 0` 0.489000 0.000000 0.489000 ( 0.489000) user system total real in-process `jruby -rrubygems -e 0` 0.848000 0.000000 0.848000 ( 0.848000) % JAVA_HOME=/home/nahi/java/jdk1.6.0_26 jruby bench/bench_jruby_init.rb 5 "-rrubygems_with_ar -e 0" user system total real in-process `jruby -rrubygems_with_ar -e 0` 7.957000 0.000000 7.957000 ( 7.893000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 3.275000 0.000000 3.275000 ( 3.275000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 2.771000 0.000000 2.771000 ( 2.771000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 2.031000 0.000000 2.031000 ( 2.031000) user system total real in-process `jruby -rrubygems_with_ar -e 0` 2.640000 0.000000 2.640000 ( 2.640000) Hmm, -rrubygems is slower. But according to -rrubygems_with_ar result, parallel_load could be faster when there're many files to be loaded? But it gets faster from 3rd try... I don't have any idea why the last result of parallel_load gets slower. // NaHi -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJOp7CMAAoJEC7N6P3yLbI23ekIALmw3VAzeTnZp6vA7DY04RXo njvmtVoEBB9iAyN9BPVU/XZErCyuGv8/Lw8aee4bQS8eGjv/oZebDqs5CHvg67G2 LegGZgZpOrz0YdjQ18DepHGiZGnh3ct7baGMWI6VJtlDH27Nkvf5x4p/krYrvEKx R2bgvUcZWEXPKmtRfI8rtH5HWO2gtT0zk4siOprPy57wGDQ1xZVW7im5Iaau+bVf lVx8OVjAMDiT8nnL6Zin/X519PwgGEoOMaavc5z1jfbfei4JmsKys0lJYc/5tRvm VDeNZePIcrDwwAbThZ+QluBN5Pl84d8n1rdjrUKw47grmpsUfBiymGvvd9Ud2DM= =ohlR -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email