6 ms·
> InvokeDynamic support This is the big one, in my opinion. See here[1] for some benchmarks of JRuby + invokedynamic. We're talking orders of magnitude for som
by ZitchDog 14y ago
> InvokeDynamic support
This is the big one, in my opinion. See here[1] for some benchmarks of JRuby + invokedynamic. We're talking orders of magnitude for some benchmarks.
[1] http://blog.headius.com/2011/08/invokedynamic-in-jruby-constant-lookup.html http://blog.headius.com/2011/08/invokedynamic-in-jruby-const...
- igouy 14y agosome benchmarks from Wed, 10 Oct 2012 jruby-1.7.0.RC2 -Xcompile.invokedynamic=true http://shootout.alioth.debian.org/u32/jruby.php http://shootout.alioth.debian.org/u32/jruby.php
- ZitchDog 14y agoI guess I should have specified, I was thinking of the benchmarks vs non-invokedynamic JRuby. No intention of starting a benchmark war. Ruby 1.9 is fast too.
- igouy 14y agoOK. Back to August 29th, JRuby 1.7.0 preview2, invoke-dynamic=true on the right, the last number is elapsed time in seconds (so 451.046 vs 258.643 with invoke-dynamic=true) -- http://anonscm.debian.org/viewvc/shootout/shootout/website/websites/u32/data/data.csv?r1=1.1021&r2=1.1022 http://anonscm.debian.org/viewvc/shootout/shootout/website/w...
- igouy 14y agoI see that ViewVC link seems to have problems showing the diff at the moment, here are elapsed seconds (without invokedynamic and with invokedynamic) jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) Server VM 1.7.0_09-b05 [linux-i386] invoke-dynamic= false true binarytrees #1 290.08 252.55 binarytrees #2 290.34 252.92 binarytreesredux #2 289.64 262.04 chameneosredux 31 39.85 32.73 fannkuchredux #2 1720.70 1481.23 fasta #6 372.59 418.07 fasta #5 294.54 270.02 fasta #1 278.98 260.14 knucleotide #2 428.75 377.28 knucleotide #1 470.40 461.46 mandelbrot #3 1404.58 1149.08 mandelbrot #1 2301.81 2167.50 meteor #1 17.59 17.42 meteor #2 13.19 13.37 nbody #1 678.62 568.72 pidigits #2 3.10 3.22 pidigits #3 25.89 25.73 pidigits #1 50.80 51.03 regexdna #1 78.76 78.60 regexdna #3 44.29 45.33 revcomp #2 24.05 24.49 spectralnorm #2 462.09 387.54 spectralnorm #1 496.94 438.55 YMMV
- deleted 14y ago[deleted]
- ksec 14y agoSo with about the same CPU time, JRuby will use up to 100x memory in worst case? Anyway Ruby 2.0 is suppose to solve the Ruby is Slow problem. although i have yet to see any evidence that will the case. Sigh.
- benmmurphy 14y agothese benchmarks also include the time it takes the vm to start up and may not include full JIT performance. locally in jruby pidigits.rb 2000 takes 4.132s, running it twice it takes 4.965s. jruby is quite annoying for running small little scripts because of the startup time but it an be quite nice for full applications.
- bascule 14y agoYes, each Ruby method needs to get executed 50 times to JIT to JVM bytecode, and from there it takes an additional 10,000 calls for HotSpot to JIT that to machine code. Any hotspots therefore need to be hit at least 10,050 times in order to be fully warmed up.
- mbell 14y agoJust start the JVM with -XX:CompileThreshold=<some_number> It only defaults to 10,000 when the JVM is running in server mode, its 1,500 when in client. Which mode a default install runs in is a bit wonky so I always explicitly set it (with -server as an argument to the JVM).
- igouy 14y ago>> jruby pidigits.rb 2000 takes 4.132s << Why did you measure a workload 1/5th of the workload shown on the benchmarks game webpages? Each program page shows measurements for 3 workloads, in the case of pi-digits 2,000 6,000 and 10,000. http://shootout.alioth.debian.org/u32/program.php?test=pidigits&lang=jruby&id=3 http://shootout.alioth.debian.org/u32/program.php?test=pidig...
- spitfire 14y agoPossibly not. Those benchmarks (mandelbrot and n-body, pi-digits) are very low memory footprint benchmarks. So it might be a difference of going from 20K to 30meg constant memory usage. Whereas the other benchmarks seem to have single digit multiples of memory usage. SO seemingly real world apps will use more memory, but not 100x in practice.
- nahname 14y agoRuby 1.9.? There is a significant difference between 1.9.1 and 1.9.3
- igouy 14y agohttp://shootout.alioth.debian.org/u32/ruby.php#about http://shootout.alioth.debian.org/u32/ruby.php#about or http://shootout.alioth.debian.org/u32/program.php?test=nbody&lang=yarv&id=2#about http://shootout.alioth.debian.org/u32/program.php?test=nbody... or ...
- bascule 14y agoIf you're confused about what InvokeDynamic is... Previously languages like Ruby suffered on the JVM as the set of JVM instructions available were designed around the Java programming language. This meant that for invoking Ruby methods and other things like accessing instance variables could not take advantage of many of the JVM's features such as method inlining. Since HotSpot is unaware of Ruby semantics, invoking Ruby methods involved a bunch of custom logic implemented in the form of bytecodes which were completely opaque to HotSpot and thus could not be optimized away. InvokeDynamic allows JRuby to teach the JVM how to invoke Ruby methods in a way that plays friendly with the HotSpot inliner. Here's a contrived example of HotSpot inlining a Ruby method and optimizing it down to a single assembly instruction: https://gist.github.com/3728777 https://gist.github.com/3728777
- rockyj 14y agoI will be happy if someone corrects me but JDK 7 has some bugs with InvokedDynamics and it is turned off by default. These bugs have been fixed in JDK 8 (beta so far). In the future, even if JRuby team does only bug fixes, JRuby will get faster and faster as JVM's support for dynamic languages improves through InvokedDynamics.
- igouy 14y agoAnd can be turned on like this: /usr/local/src/jruby-1.7.0/bin/jruby -Xcompile.invokedynamic=true