JavaFX performance for complex visualisations
richard.bair at oracle.com
Tue Dec 4 12:24:22 PST 2012
Just getting through my email and have had this one flagged since Devoxx :-). I respond below to individual points but most of these are probably not worth you responding back on (they're just informational on my part) -- rather, down at the end is the real question I want to have a discussion on (and will be a lot of fun to solve while we're at it).
> 1. Do any such games, animations or visualisations exist yet?
Yes. Much like Swing, JavaFX is seeing a lot of adoption in the heavy enterprise desktop sorts of use cases -- not the kind of thing you will find when browsing the internet. Most of these folks don't advertise the technology they're using, and most of them are not interested in letting their competitors know what they're doing or what technology they're using. Which basically means, if we haven't built a demo for it, there isn't anything you will find in your travels.
> 2. If not, how does Oracle or anyone else actually know that JavaFX is
> capable of supporting such applications?
That is a good question. Many of the folks I've talked to building such applications have done incredible work + proof of concepts long before I even knew they were using JavaFX. Now, each year we do pretty graphically intense demos for JavaOne, so we have a pretty good feel for it. We have a bunch of benchmarks where we crank the number of nodes up to pretty high numbers, and we know from these benchmarks (at least) that we scale very well compared to other technologies. But I know neither the samples nor the results are publicly available. But at least I can answer the "how does Oracle … know" part of the question.
We have had a performance team from the get-go who were solely dedicated to writing benchmarks, running benchmarks, and analyzing results. This has been incredibly helpful. We have results that come not just from the weekly integrations but even from intra-week builds on specific scrum repositories. We have benchmarks and analysis for both desktop and embedded and take performance very seriously.
Now, there are a lot of ways to use the platform. Some things are better tuned than others. Performance work is driven by tuning and benchmarks. So when we run into issues we have to (a) determine how likely that is to be an issue to the broader development community (b) figure out what the tradeoffs are (usually performance & quality are directly in contradiction with each other), and ( c) schedule & implement the fix. Of course, the same few people (Jim, mostly) are involved in many of the performance fixes and features (like Canvas), so scheduling is an issue and feedback from customers as to what they are actually running into (vs. what a theoretical issue is) has priority.
> 3. Do I have the wrong understanding that JavaFX is supposed to support such
We expect that JavaFX will be usable for casual games, but we are not building a gaming platform to compete with Unity and the like. If we happen to be just as good, then that's awesome, but it isn't our primary goal. Advanced visualizations, on the other hand, are part of our target market (medical, pharma, enterprise desktop, etc)
> 4. Is it possible that, for whatever reason, JavaFX is simply not capable of
> supporting such applications?
There are natural trade-offs between an immediate mode (like Canvas) API and a retained mode (like Scene Graph) API. Now that we have both (plus Java2D + ImageWriter and such for the really crazy cases) we should be capable of a wide range of use cases. However, some things are not yet optimized. But there is no technical reason why we shouldn't be quite capable.
Another area we have not yet exposed API which is problematic for some people is in the area of custom shaders. It may be that without some kind of custom shader support (which would have to be made to work on D3D as well as OpenGL) certain use cases cannot be easily fulfilled.
> My feeling that JavaFX can indeed support such applications is based on the
> fact that it is hardware accelerated and therefore it should be limited
> mostly by the capabilities of the graphics card and also because it is often
> talked about in this way. However, I have observed varying levels of
> performance that don't quite follow these principles such as JavaFX
> performing poorly with choppy/jittery animations and transitions on my most
> powerful machine with an NVIDIA GeForce GTX 690 (the current fastest
> graphics card in the world) but performing quite well on machines with much
> lower specifications.
It is highly unlikely that this is due to performance issues. As mentioned in the last few days on another thread, there are smoothness issues that are completely separate from performance (although both are often talked about together). We're working on the smoothness. Sometimes this is an application problem as opposed to a platform problem (one such example is the DisplayShelf sample, which needs to be rewritten).
> So I guess I am curious to know what kinds of testing and evaluations Oracle
> has undertaken to determine the performance characteristics of JavaFX and
> exactly what kinds of applications it is actually suitable for. For
> example, I am yet to see any JavaFX application with even the sophistication
> of a Flash electronic greeting card or banner ad and yet I assume JavaFX
> will be used for such purposes eventually.
I would imagine any of our demos from the last 3-4 years of JavaOne would demonstrate much more complicated use cases than that! But, instead of me just complaining -- lets build one! We'll add it both to Ensemble and our test suite. We can start with something simple (like a greeting card) and expand it out to something wildly complex. What would you like to see? One thing I've wanted to build for years but haven't found the time for was a tower defense game. But what would you think would be a good example of graphics performance that would tell you "hey, this platform is great for visualizations"?
More information about the openjfx-dev