I've added in PutConst and modified the "fib_complex" benchmark to run on the IR2JVM JIT. Things are looking pretty good.
The benchmark is at the bottom of this email, but it basically just modifies bench/bench_fib_complex.rb by removing all library and closure use and having a fixed fib(37) for ten iterations. It basically does fib, fib with the Fixnum 1 and 2 in local variables instead of directly, with separate Ruby method calls for + and -, with 1 and 2 looked up from constants, and then a combination of these. The idea is that local variable use, trivial method calls, and constant lookups should *ideally* not increase the base time at all. Here's Ruby 1.9.3 for comparison. Note that each level of complexity takes another drop from the base performance (which is slower than the slowest JRuby run, fwiw): normal fib 4.982727 fib with variables 6.093514 fib with constants 7.154796 fib with additional calls 15.82317 fib with constants and additional calls 17.376949 Oddly enough these numbers seem rather variable and I'm not sure why. They should stay consistently the same, but perhaps there's some weird memory effect hitting MRI here: normal fib 8.621707 fib with variables 11.082168 fib with constants 13.325111 fib with additional calls 29.362528 fib with constants and additional calls 26.660991 ANYWAY...here's JRuby master, normal JIT, Java 7u3: normal fib 0.805 fib with variables 1.007 fib with constants 2.001 fib with additional calls 1.192 fib with constants and additional calls 2.323 The important thing to notice is that constant lookup for "ONE" and "TWO" adds a whole second to each iteration. That's largely because the old JIT doesn't pass along all necessary structures for looking up constants, so we have to go to a thread-local structure every time (and push/pop that information on method entry/exit). Here's IR2JVM, which I'm writing to pass along all necessary structures for const lookup, etc: normal fib 1.06 fib with variables 1.511 fib with constants 1.572 fib with additional calls 1.853 fib with constants and additional calls 1.826 In this case, variables and additional calls add a bit of complexity, which is probably due to there just being more code in the IR version (which we can improve). However, constants add almost no overhead at all...they're actually getting to the point of being 100% free here. That will be very important for typical Ruby applications. Anyway, good progress. - Charlie --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email