views:

569

answers:

5

We are trying to compare 7 different programming technologies for browser based client applications. Please give your thoughts on this speed comparison.

What will the future bring? Will HTML5 replaces Flash and Silverlight in the browser or will JavaScript always be too slow for any CPU intensive applications. Could Roozz plugin completely remove the need for desktops? (similar to what Chrome OS proposes)

www.3djam.com/speed_demo.aspx

A: 

Simple, knee jerk answer. As far as "raw performance", JavaScript in the browser has at least 3 major companies working to improve the overall speed of that platform.

Flash and Silverlight each have, respectively, 1 company working on that problem.

So, if you believe at all in the "power" of competition, that simple observation should give you an idea of where things may go in the future.

Will Hartung
That's a very handwavy answer. What about JavaScript language and runtime semantics that make it inherently harder, and sometimes impossible, to optimize, compared to, say, Java or C#?
Pavel Minaev
A: 

JavaScript is receiving a lot of attention lately and browsers are implementing increasingly faster engines. HTML5 does indeed make much of Flex and Silverlight redundant - particularly features like offline/local storage, cross-site scripting, canvas, and web sockets. HTML5 is a long way off from becoming a standard, but browsers are quickly implementing many of the features proposed in the draft already, since it provides so much immediate benefit.

Your question topic is a little silly though. There's little value in comparing JavaScript to "ASM" or C++.

Wahnfrieden
A: 

Neither C#, C++, nor ASM are languages one uses to create client-side browser application...so that's moot.

I think what you'll find is that certainly languages or packages are going to be optimized for certain operations; it's not meaningful to say "JS is faster than Flash" without providing the context of "while doing XYZ."

Generally speaking, I'd bet on the JS/HTML vs. a proprietary (albeit widely adopted) technology like Flash being pushed by a single company seeking "lock-in". History is full of examples of things like Flash getting replaced via more general and broadly supported technologies. Ask yourself: why do we NEED Flash or Silverlight? As JS/HTML mature, they will naturally evolve to address the issues which have caused the rise of Flash or Silverlight in the first place.

DarkSquid
@DarkSquid: I'd argue that C# is precisely a language one would use to create client-side browser applications. What do you think the source code for Silverlight applications can be written in?
Grant Wagner
Well, I suppose; I wasn't thinking in term of languages which are then run via a container like the Silverlight player...and in that case, I would guess one would be more constrained by the container's performance than the particular language one used to create the package which was played therein (you could make the same argument for x86 assembler used via Silverlight, of course).
DarkSquid
Silverlight is not true cross platform. It is not even supported on Windows Mobile. And until yesterday Moonlight did not support silverlight 2.0 stuff.
Thomas3D
+1  A: 

The trouble with considering Javascript is that implementations are still so different between browsers. For example, IE's Javascript engine is still slow compared to the likes of V8. So to build an extremely processor-intensive Javascript app may cause those running IE to leave out of frustration.

But I'd venture to say that Silverlight probably has the fastest raw execution time at the moment that can run cross-browser. It's running an abbreviated version of the .NET framework. And from what I've seen C# is typically within 10-20% the speed of C++ for raw number crunching tasks. A lot of benchmarks out there skew this one way or the other, but any carefully designed benchmark typically shows the performance to be surprisingly close.

Of course, you should note that Silverlight was designed to use a lower CPU priority than a desktop C# application so as not to bring the browser to a halt (it'll never use 100% CPU). But still, for something that can run in a browser Silverlight's overall performance is quite good.

Here are a couple of good sources comparing C# to C++ (among other languages):

Microbenchmarking C++, C#, and Java

The Computer Language Benchmarks Game

Steve Wortham
Hi TheSteve. I have never seen C# run within 20% of C++ speed. In fact I have never even seen C# run half speed of C++. Could you supply such an example? We have tried all the 7 languages above on all the platforms where they are availeble for comparison. C++ and ASM is MUCH faster than any of the scripting languages. But of course ASM is not really cross platform. But if only program tight loops in ASM then you can get very far if you support x86 and ARM.
Thomas3D
Sure, I just added a couple links. C++ tends to have a significant advantage when it comes to double-precision math. But the difference in int32-precision math seems to be negligible. On the other hand, there are some tests where C# can be faster. That Dr. Dobb's article is great to illustrate all of this.
Steve Wortham
A: 

HTML5 is definitely step up in client-side application. But nevertheless I believe that scripting languages will never be as fast as JIT frameworks and JIT in turn will never be faster than statically compiled code, it's a payment for cross-platform ability.

Anyway, I think it's not correct to compare Javascript and Flash, Java applets, Silverlight and etc. It's more correctly to make comparison of Flash, Java applets, Silverlight, C++ instead.