Performance regression in 1.6.x in using procs as Java interface impls (closure conversion) -------------------------------------------------------------------------------------------
Key: JRUBY-5963 URL: https://jira.codehaus.org/browse/JRUBY-5963 Project: JRuby Issue Type: Bug Components: Java Integration Affects Versions: JRuby 1.6.3, JRuby 1.6.2, JRuby 1.6.1, JRuby 1.6 Environment: Windows 7 x64 Sun JDK 6u24 Reporter: Joseph Wong There seems to have been a major performance degradation in JRuby 1.6.x (compared to 1.5.x) in using procs as Java interface implementations (aka closure conversion - http://kenai.com/projects/jruby/pages/CallingJavaFromJRuby#Closure_conversion) This can be reproduced via the following files: {code:title=CallbackTest.java} public final class CallbackTest { public static interface Callback { public String dummy(String arg); } public static void test(Callback cb) { cb.dummy("Hello"); } } {code} {code:title=test_callback.rb} require 'java' require 'benchmark' $CLASSPATH << File.dirname(__FILE__) CallbackTest = JavaUtilities.get_proxy_class('CallbackTest') Benchmark.bmbm do |b| b.report 'callback_test' do 10000.times do CallbackTest.test do |s| s end end end end {code} These are the results I get: {noformat} jruby-1.6.2-perf-bug-repro>..\jruby-1.6.2\bin\jruby test_callback.rb Rehearsal ------------------------------------------------- callback_test 13.278000 0.000000 13.278000 ( 13.244000) --------------------------------------- total: 13.278000sec user system total real callback_test 19.858000 0.000000 19.858000 ( 19.858000) jruby-1.6.2-perf-bug-repro>..\jruby-1.5.1\bin\jruby test_callback.rb Rehearsal ------------------------------------------------- callback_test 1.621000 0.000000 1.621000 ( 1.586000) ---------------------------------------- total: 1.621000sec user system total real callback_test 0.568000 0.000000 0.568000 ( 0.568000) jruby-1.6.2-perf-bug-repro>..\jruby-1.6.2\bin\jruby -J-Djruby.jit.threshold=0 -J-Djruby.compile.mode=JIT -J-server -J-Xbatch test_callback.rb Rehearsal ------------------------------------------------- callback_test 15.490000 0.000000 15.490000 ( 15.446000) --------------------------------------- total: 15.490000sec user system total real callback_test 19.911000 0.000000 19.911000 ( 19.911000) jruby-1.6.2-perf-bug-repro>..\jruby-1.5.1\bin\jruby -J-Djruby.jit.threshold=0 -J-Djruby.compile.mode=JIT -J-server -J-Xbatch test_callback.rb Rehearsal ------------------------------------------------- callback_test 2.815000 0.000000 2.815000 ( 2.772000) ---------------------------------------- total: 2.815000sec user system total real callback_test 0.439000 0.000000 0.439000 ( 0.439000) {noformat} Looks like the source of the performance regression is in the commit 5d8bfad5 on Dec 17, 2010 "using OneShotClassLoader to generate interface wrappers". Was the reason for the switch to use non-cacheable proxy classes so that they can be garbage-collected? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email