欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

JavaFX1.2的性能貌似有了很大的提升

程序员文章站 2022-03-13 15:01:23
...
  Osvaldo Pinali Doederlein's Blog中提到,作者使用Bubblemark进行了一个简单的测试,JavaFX的性能较JavaFX1.1有了~16倍的提升,虽然比Swing还差一些,但已经可以接受(比Flash&Silverlight好很多)。
引用
Performance Results

Now let’s move to the fun part. These are my preliminary results with this “beta” JavaFX Balls code, running on the JavaFX 1.2 runtime:

    * 16 Balls: 665fps (1.1 = 340fps; 1.2 is 1.95X faster)
    * 128 Balls: 330fps (1.1 = 20fps; 1.2 is 16.5X faster)
    * Adaptive mode (200fps): 221 Balls (1.1 = 30 Balls; 1.2 handles 7,3X more load). I could also get 560 Balls @ 60fps.
    * Mobile (emulated), Adaptive mode (25fps): 91 Balls (1.1 = 82 Balls; 1.2 handles 11% more load)

JavaFX 1.2 has a completely rewritten animation core, and it shows. When I evaluated JavaFX 1.0, I complained and cried and whined about the poor scalability of its SceneGraph package, with the conclusion that JavaFX would “stand no chance” to implement serious animations (e.g. for action games, except for clones of trivial 1970's hits like Pac-Man). But this is now past.

The performance can be even bigger in a “pure” animation: I found that the controls are relatively heavyweight (even with caching). If I remove the control toolbar, I get 16 Balls @ 992fps (almost reaching the 1000fps cap), or 128 Balls @ 380fps. Even more interesting is CPU usage: the 16 Balls score consumed less than 1% CPU (Q6600), and even the 128 Balls score consumed only 16% CPU. So the program is clearly not constrained by CPU, but rather by other factors like timers or VRAM/DRAM bandwidth.

These results compare very favorably with most other Bubblemark contenders (both Java and other platforms). The very best score that I’ve seen before was for PulpCore: it scores 16 Balls @ 410fps, but 128 Balls @ 90fps only; and both saturated a full CPU core (25% of a quad-core). I tested again other competitors (including Flash and Silverlight 2), and they are all much worse than JavaFX in either FPS or CPU usage (often both).