Skip to content

Generate smaller bytecode when using Ruby type on implemented Java Interface + Benchmark#4777

Merged
headius merged 1 commit intojruby:masterfrom
original-brownbear:smaller-bytecode-javainterface-impl
Sep 5, 2017
Merged

Generate smaller bytecode when using Ruby type on implemented Java Interface + Benchmark#4777
headius merged 1 commit intojruby:masterfrom
original-brownbear:smaller-bytecode-javainterface-impl

Conversation

@original-brownbear
Copy link
Contributor

It seems when compiling Ruby implementations of Java interfaces, we were generating bytecode that runs any non-primitive type through convertJavaToUsableRubyObject.
This seems unnecessary to me if we know that we're dealing with an IRubyObject type of argument => we can save that call and the loading of the Ruby runtime argument, right?

I included the benchmark I used to verify that this comes with a positive performance impact (for me it showed about a 5% speed-up).

@kares
Copy link
Member

kares commented Sep 5, 2017

totally makes sense - thanks for digging throught these bits, there's probably a lot of 💎 to be found :)

@headius
Copy link
Member

headius commented Sep 5, 2017

👍 looks good. There's a lot of gems hidden in interface impl and concrete subclass logic:

  • Use indy to optimize method lookups, dispatch, and type conversion
  • Move more logic to utility methods

This is a good start :-)

@headius headius merged commit 6e9854f into jruby:master Sep 5, 2017
@original-brownbear original-brownbear deleted the smaller-bytecode-javainterface-impl branch September 5, 2017 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants