Dot Product Thoughts

John Rose john.r.rose at oracle.com
Thu Apr 18 18:07:41 PDT 2013


On Apr 18, 2013, at 5:34 PM, Richard Warburton <richard.warburton at gmail.com> wrote:

> * What should I avoid when Java 8 is released?  So given the current state of play that the implementation of method inlining isn't meeting its full potential, you've outlined a basic scenario where you get poor performance: when the leaf calls do very little.  Internally (or even better publicly) have people identified what they would think of as the "sweet spot" for mathematical operations?  In other words: where do you think the streams framework retains the idiomatic benefit and has a more limited performance penalty?

The sweet spot streams are designed for is bulk data [1].  So your vectors need to be bulky!

My main reservation about this use case is that much linear algebra work operates on short vectors (2-4 dimensions for simple physical models, or smallish dimensions for sparse array parts).

My other point is simply that deploying a major new programming facility on the JVM requires sustained JVM optimization work after the fact.

> * Can people do anything to help?

Thanks for asking.  Clear standard benchmarks will be needed eventually.  As a prerequisite to that, people should just use lambdas and streams (especially on bulk data) and observe where the pain points are, both in design and performance.  When evaluating a performance pain point, it always helps if contributors know how to coax performance data from the JVM [2], [3].

> Are you hoping for more performance problems to be presented, or are there enough already, known well, and the issue is basically in the JIT team solving the issues that John has outlined above?

The latter; the main issue is JIT engineering.  We have a long list (which I alluded to before) of things we know we need to do to make streams fast.  Also, we expect to learn more as (a) we improve code and (b) people find new ways to use streams.  I expect we can iterate on (a) and (b) some before JDK 8 FCS, and I also expect the iterations to continue long after that.

[1] http://openjdk.java.net/jeps/107
[2] https://wiki.openjdk.java.net/display/HotSpot/MicroBenchmarks
[3] https://wiki.openjdk.java.net/display/HotSpot/PrintAssembly

— John


More information about the lambda-dev mailing list