Experiment using inline class paired with interface

Brian Goetz brian.goetz at oracle.com
Wed Jan 8 19:25:59 UTC 2020


Some of you might recall, at the OCO keynote I showed an example of 
speedup using inline classes in a Mandelbrot set viewer, which compared 
the obvious Complex class with the obvious inline equivalent.  While 
there is little heap density/flatness benefit in this example, it does 
expose a lot of opportunity for better EA.  The one bit change (identity 
to inline) yielded a difference in effective frame rate from 16fps to 
47fps.

Mikael modified this demo to use a hand-written pair of types, an 
interface (IComplex) with one implementation, as a way of estimating 
what sort of performance penalties we might pay when using a reference 
wrapper (Foo.ref) across API calls.  The results were encouraging; frame 
rates were about the same as with the single inline class (though 
allocation went up a tad.) But this seems a useful PoC that we are not 
giving up too much by the inline-interface pair approach.





More information about the valhalla-dev mailing list