JavaFX script vs ActionScript Performance

In a previous post I compared Java performance to that of ActionScript,

Thanks to the efforts of our JavaFX script compiler team (Robert Field, Per Bothner, Brian Goetz) the performance of JavaFX script is now on par with Java in many cases.

Repeating the same Takeuchi benchmark (but with 1000 iterations this time) with JavaFX script vs ActionScript yields the following results:

Here's the FX script:


function tak(x:Number, y:Number, z:Number): Number {
    if (y >= x) z else tak(tak(x-1, y, z),
                           tak(y-1, z, x),
                           tak(z-1, x, y));
}

for (i in [1..1000]) {
    tak(24, 16, 8);
}

javafxc Tak.fx

With the hotspot server vm:

time javafx -server -cp . Tak

real    0m10.432s
user    0m10.273s
sys     0m0.101s

With the client vm:

time javafx  -cp . Tak

real    0m23.763s
user    0m23.449s
sys     0m0.146s

And here's the ActionScript (statically typed):
package {
    function tak(x:Number, y:Number , z:Number):Number {
        return y >= x ? z : tak(tak(x-1, y, z),
                                tak(y-1, z, x),
                                tak(z-1, x, y));
    }
    
    var i = 0;
    while (i < 1000) {
        tak(24, 16, 8);
        i++;
    }

}

java -jar asc.jar -import builtin.abc tak.as

tak.abc, 205 bytes written
time ./avmplus tak.abc 

real    2m1.013s
user    1m59.350s
sys     0m0.642s
But, removing the package declaration, yields the following result:
java -jar asc.jar -import builtin.abc tak2.as
tak2.abc, 208 bytes written

time ./avmplus tak2.abc 

real    10m50.701s
user    10m40.793s
sys     0m3.318s

In summary, for this benchmark, with the hotspot server vm, JavaFX script outperforms statically typed ActionScript by a factor of 12, dynamically typed ActionScript by a factor of 65.

Comments:

Nice to hear.

However, it's the performance of the underlying scenegraph libraries, and how cleverly the animations give the illusion that all effects have been applied that matter in the end.

Posted by Chui on August 23, 2008 at 04:21 PM PDT #

what about using the same tests as used there

http://tamarin-builds.mozilla.org/performance/

?

Posted by zwetan on August 24, 2008 at 10:49 AM PDT #

Ok, that's pretty impressive. But how many client machines have the server vm installed? Seems to be the only test that is gamine is the client vm test.

Btw - if you want to be fair you ought to include Curl in your bench marks. Curl has been shown to be 8 - 10 faster than ActionScript (see http://developers.curl.com/blogs/community_blog/2008/05/12/comparing-the-performance-of-curl-and-flex-3).

Let me know if you need help with this. I would be glad to facilitate.

Posted by Richard Monson-Haefel on August 25, 2008 at 12:21 AM PDT #

We all know the JVM, after it had time to load classes and perform hotspotting, is quite fast.
However pervasiveness, load time and responsiveness is typically where Flash/Flex shines so I remain skeptical.

Posted by Casper Bang on August 25, 2008 at 01:34 PM PDT #

@Richard Monson-Haefel

JavaSE always includes the server vm - and the new Java browser plugin in Java 1.6u10 allows any applet to use it.

Posted by Chris Oliver on August 25, 2008 at 02:01 PM PDT #

Last time I checked, the Windows JRE did not include the server VM (I believe to reduce download size). You had to download the JDK in order to get the server VM. Has this changed?

Posted by guest on August 25, 2008 at 02:39 PM PDT #

the server vm is only included in the development kit not in the runetime.

BUT for java 7 (and 6.next backports) are tiered vms planed which unify client and server compilers with the theoretical advantage of the top speed of the c2 and the startup time of c1.

Posted by mbien on August 25, 2008 at 04:04 PM PDT #

害虫駆除

Posted by 害虫駆除 on August 25, 2008 at 07:36 PM PDT #

About the fact that the server is not included in Windows JRE (only on JDK), it seems that the benchmark show JavaFX much faster than ActionScript even for the Client VM (0m23.763s vs 2m1.013s in the best case for ActionScript) ;-)

Posted by Hervé on August 26, 2008 at 05:34 AM PDT #

Are these timings for the version of the compiler shipped with the recent preview SDK?

It's always good to hear about these perf stats, but I agree with Chui and Casper Bang - how is JavaFX going to measure up with regard to user perception which includes softer aspects like start up time.

Keep up the good work guys - I'm liking JavaFX a lot.

Posted by Chris Lowe on August 27, 2008 at 03:22 AM PDT #

OK. Change while of ActionScript and writer for in the example ActionScript please.

Posted by Emilio on August 30, 2008 at 07:59 AM PDT #

Totally missing the point! This is just again one of these useless benchmark skewed to prove your better than the rest but that doesn't mean anything in real life.

So what if the Java VM can calculate faster than the Tamarin VM? Number crunching isn't the target of ActionScript/Flex!!! RIAs are its goal and hence what's important:
-fast VM download/hassless installation&upgrade
- good looking graphics/rich component library & good graphics performance & easy programming model
- support & good performance for all sort of photo/video/audio formats
-easy & fast client server communication (AMF3 protocol)

In all these areas Flex shines and is light years ahead of Java/JavaFX. E.g. the guys at Sun don't even seem to have given client server communication for a JavaFX RIA any thought. What's available: RMI but that doesn't work on the internet (firewalls remember...). Oh so use web services, that's what their for right? Uh ... no! It's ok for loose (and slow) back end integration but not really for tight & efficient client server communication. That's just useless XML bloat. I'll take an efficient binary protocol like AMF3 anytime over that.

Don't think I'm a Java hater: I've been doing java server side development for more than a decade. But If I would need to develop a RIA right now I would definitely choose Flex over JavaFX (of course the backend would still be Java).

Posted by Neo on September 25, 2008 at 07:19 AM PDT #

Last time I checked, the Windows JRE did not include the server VM (I believe to reduce download size). You had to download the JDK in order to get the server VM. Has this changed?

Posted by laptop battery on November 07, 2008 at 03:54 PM PST #

Nice one thanQ

Posted by Anil on November 13, 2008 at 07:10 PM PST #

The biggest issue still seems to be startup time which is off the charts. One can go and have a coffee while JFX starts an application. Sad.

Posted by mdo on December 05, 2008 at 04:54 PM PST #

What you need to time is how many times a scene repaints when doing a certain animation, and how quickly the scene repaints when interacting with part of it. Those are the only two points which matter when it comes to scripting user interfaces as any slow computation can always be run on another thread (unless you are writing Action Script, of course. LOL!)

Posted by Trejkaz on March 06, 2009 at 05:27 PM PST #

JavaSE always includes the server vm - and the new Java browser plugin in Java 1.6u10 allows any applet to use it.

Posted by Warhammer Online Gold on March 11, 2009 at 03:45 PM PDT #

http://www.Sohbetizm.Net
thank you very much . very good blog.

Posted by çet on May 17, 2009 at 09:26 PM PDT #

http://www.smsmatbaa.com

Posted by matbaa on June 22, 2009 at 02:54 AM PDT #

thank you very much . very good blog.

www.meganba.com
http://nbaoyunculari.blogspot.com
http://basketbolhaberleri.blogspot.com
http://meganba.wordpress.com
www.yazgunu.net

Posted by NBA on June 30, 2009 at 06:30 PM PDT #

important and awake! great job bro thanks.

Posted by Egitim on December 11, 2010 at 05:50 AM PST #

Simple and Nice example !

Posted by شات on December 15, 2010 at 03:44 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

user12610627

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today