Chris Oliver's Weblog

Saturday Aug 25, 2007

Bubblemark

This posting says some nice things about JavaFX, but also points out that in its current incarnation its performance is lacking:

The first thing you’ll notice is that it’s very slow. The demo takes a very long time to load and start, and real time performance is disappointing. Here is how it compares:

JavaFX — 14 fps
Firefox + Silverlight (JavaScript) — 56 fps
Firefox + Flex — 62 fps
Adobe AIR — 62 fps
Firefox + Silverlight (CLR) — 99 202 fps (update: 202 fps after fixing main timer’s latency)

(All tests were performed on Pentium M 1.7 machine under Windows XP SP2)

It is 4.4x slower than Flash and 7x 14x slower than Silverlight (CLR-based variant).

On a positive side, development with JavaFX is fun, the language is very compact and efficient for building complex dynamic layouts. There is a great converter to JavaFX from SVG format and JavaFXPad is done nicely too.

If only it were 5x faster!

Of course, our intention is to provide hardware-accelerated vector graphics and compile JavaFX script to JVM bytecode getting the full benefits of the hotspot virtual machine, and to provide an improved deployment system, and we're working on that.

The Bubblemark performance described above is caused by

  • Download time - size of the deployment unit - The bubblemark JNLP doesn't use pack200 compression so the download of the JavaFX runtime + the app is ~2.1 MB
  • Performance of the JavaFX interpreter in doing the collision detection - which is currently probably 50-100 times slower than doing it in Java
  • Lack of caching or hardware acceleration of the vector graphics and gradients that make up the ball
Eventually, a production-quality JavaFX will automatically provide these benefits but in the meantime because JavaFX builds on Java, it's possible to get respectable performance for Bubblemark by making a few minor changes:
  1. Use pack200 compression for the Jar files
  2. Do the collision detection in Java code
  3. Cache the vector graphic at the application level - since once created it's static in this application

Below's a version of Bubblemark in JavaFX that does that.

Here's a link to the source code

Comments:

On my MBP, 2.4G, 2G RAM I get about 85fps with 16 balls in play using your new code, nice job. Other numbers: Silverlight JS up to 130fps, DHTML 150fps, Flex 50+fps, Flex cached same?, Swing ~120fps, Silverlight CLR not working (not recognizing install). Anyway, nice job. I like seeing these little demos you do, easy to run, quick to start, fun to play with. Cheers, Patrick

Posted by Patrick Wright on August 26, 2007 at 02:15 AM PDT #

JavaFX runtime + the app=2.1 MB ?

JavaFX is not need JRE?

Posted by G.z on August 27, 2007 at 07:51 PM PDT #

Hi Chris,
How can we Image Cache the JFX object ?

I have a complex SVG file which is converted to JavaFX Script using SVG converter. Its performance is fine, till I tried to scale it.

For mouse Over effect I like to scale this SVG-FX object by factor of 10% increase in Size. Its current performance is very poor. I belive its because JavaFX script is redrawing the complex JAVAFX script again and again.
Is there a way Buffer the final Image and use it instead of redrawing for every mouseOver scaling.

This kind of Image buffering is almost every where used in GUI Effects and Animations.
I hope JavaFX can provide a easy way to do this task(instead of manually creating a bufferedImage and drawing to it for every object).
something like,
myobj.enableBuffer = true

Posted by Kishore on August 28, 2007 at 07:05 AM PDT #

Why you don't post this example to http://www.bubblemar.com web site? The old version is poor and it doesn't help javafx reputation

Posted by Lorenzo on September 09, 2007 at 07:11 AM PDT #

There is a big hole in JavaFX.
Threading.
It seems from the language docs if you use "do" or "do later" you have to use Java classes and look after your own synchronization (and error returns).

This required a VERY skillful programmer.

What we need is threading and result synchronization that the 'average' programmer can use and access directly from the scripting language.

Posted by Matthew on September 13, 2007 at 07:33 PM PDT #

Patrick,

If DHTML is faster than Flash ("Flex"), whatever browser you use there is something going wrong. Safari on OSX can approach flash performance, but other browsers don't even come close not to mention surpassing it.. Same for Swing, it should definitely be faster than DHTML and it's slightly faster than Flash in my tests.

Posted by Fred on September 20, 2007 at 02:35 PM PDT #

Maybe JavaFx will be, like Java, very successful - but mainly on the server. Remember how Java's initial fame came from applets!

To be honest i haven't looked at Java for about 4 years. I began to find it boring - especially after using clientside Javascript/Ajax and server side Ruby. JavaFx looks very good - especially for the serverside. On the client side i dont think anything can resurect Swing etc, however good the language - and i think its very good.

However, it looks like a great language for web scripting/frameworks against sql db's. Especially if the functional "select.." syntax hooks up with sql databases (and possibly data oriented xml docs).
Indeed, with the attribute and trigger functionality it seems as if ER diagrams have been "implemented". Excellent. Pure SQL is to much about - break your data into tables, put it back together, oops the data has been "denormalised".Has any thought been given to JavaFx's server side usage.

Imo you have made very good design decision s in what ideas to use from javascript,ruby,python and functional languages. eg JavaFx has, like Brendan Eich design goals for EcmaScript4 taken a "functional and structural" aproach rather than an class based 00 one - which isn't declarative enough.

If a language with syntax like JavaFx existed *in* the browser and on the desktop for os scripting ahhh....

JavaFx, or something similar would be an excellent candidate for the Ecmascript4 syntax.

Posted by james c on September 20, 2007 at 03:49 PM PDT #

James C,
If you haven't looked at Java in 4 years then why comment on Swing or anything Java related? The language has changed a lot in 4 years. When I started using Java in 2000 at University, it was not known for its applets at all. It was instead known for its platform independence and ease of development when compared to C and C++. Which is why MS brought out C# as competition. There is a reason why Java is still the #1 programming language today.

User friendliness and HCI are the most important features (and most difficult to implement) in any application. So making UI design and development easier is certainly the way to go. From what I've seen of Matisse and JFX script, Sun is heading in the right direction.

Chris Olivier,
I've been using JFX script for a bit now, while trying to become an early adopter. I've been highly impressed with it, especially on the visual side of things. It has been a real joy to program in. I hope to be designing real world graphic user interfaces with it very soon, especially flash-like JFX web-pages. Excellent work so far and all the best with it.

Posted by Jean-Pierre Nel on September 26, 2007 at 12:28 AM PDT #

A big improvement.

Interestingly, I noticed that during the test I was getting 56fps AND my CPU usage was barely ticking over at 5-12%. Okay, I have a dual CPU setup so double that figure. So maybe there is much more potential to up those fps figures?

Maybe I'm seeing some of the D3D benefits of the new Update N JRE.

It's been a while since you posted anything, any chance of a nice new app on which to test the new quick start feature of Update N? ;)

C.

Posted by Chris Lowe on October 04, 2007 at 02:24 PM PDT #

Re my comment above. Perhaps JavaFx will find its role in .....
ANDROID.

Frankly, i can't stomach programming in Java but Android looks interesting. Solution: JavaFx.

The only change to JavaFx i would like to see is to use a Ruby/Lua approach to blocks leaving {} for records/dicts.
eg
From:
if (x == y) {
doSomthing()
}

To:
if x == y then
doSomething()
end

or

if x == y
doSomething()
end

(I appreciate this change would have an impact on if expressions)

Posted by James C on November 12, 2007 at 12:28 PM PST #

Thanks.. Nice ; )

Posted by forum,oyun,msn,iddaa on November 23, 2007 at 09:35 AM PST #

interesting! I'm looking forward to se the plugins available.

Posted by geciktirici on December 29, 2007 at 04:03 PM PST #

Thank You

Posted by Adult Forum on January 23, 2008 at 02:18 AM PST #

thanks for this post

Posted by Giyontin Kesim on January 26, 2008 at 06:25 AM PST #

buy cialis online, Cheap and online cialis
Thanks

Posted by buy cialis online on February 04, 2008 at 01:23 PM PST #

I should probably revise that phrase, because I don't believe that memory is crucially dependent on language or linguistic ontologies, though I definitely see why you might think I meant that.

Posted by Adult Forum on February 24, 2008 at 07:23 AM PST #

Your comment contains very useful information about all thank you <a href="http://www.tercumeservisi.com" rel="follow muse" title="tercüme bürolari">Terc&uuml;me b&uuml;rosu</a>

Posted by Tercüme bürosu on March 04, 2008 at 01:44 AM PST #

Your comment contains very useful information about all thank you

Posted by Tercüme bürosu on March 04, 2008 at 02:04 AM PST #

realy nice site, thanks for informations

Posted by gry do ściągnięcia on March 10, 2008 at 08:23 AM PDT #

hey, can i translate this article to my site?

Posted by download mp3 on March 10, 2008 at 08:24 AM PDT #

happy birthday!

Posted by prosedda on April 23, 2008 at 02:08 PM PDT #

thanks

Posted by çiçek on May 03, 2008 at 01:04 PM PDT #

thanks my brother

Posted by mobilyaci on May 11, 2008 at 06:23 AM PDT #

thanks brother

Posted by travesti on May 11, 2008 at 06:24 AM PDT #

thanks very

Posted by mirc on May 11, 2008 at 07:43 AM PDT #

thank your

Posted by chat on May 11, 2008 at 07:44 AM PDT #

cheldern thanks

Posted by mirc on May 11, 2008 at 07:47 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referers