Javascript vs. Flash & Silverlight? How about vs. Java & .NET?

B5d5f89b052f80a875dd85427a116724
0
Daddy_Warbox 101 Sep 08, 2008 at 10:49

First, read these:

http://news.cnet.com/8301-17939_109-10034365-2.html

http://arstechnica.com/journals/linux.ars/2008/09/03/new-firefox-javascript-engine-is-faster-than-chromes-v8

Imagine if Javascript was optimized to the point of being comparable with .NET’s CLR and Java. The irony alone would be worth it to try.

Do you think this might happen? And what do you think would happen if it did reach that level?

19 Replies

Please log in or register to post a reply.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 09, 2008 at 00:13

It sounds interesting, however, it also sounds like the results will be inconsistent depending on which browser you are using, which means those other languages won’t have much to worry about it for a while anyway. If it gets fast, great, but it probably still won’t have the multimedia capabilities. What we will probably see is even further use of AJAX type things that run a whole lot faster and that will be great.

B5d5f89b052f80a875dd85427a116724
0
Daddy_Warbox 101 Sep 09, 2008 at 10:03

Well adding multimedia capabilities is nothing a few plugins can’t handle I’d imagine.

My theory is this: Microsoft can choose to keep IE’s JavaScript engine unoptimized to pressure people to use their .NET and SilverLight junk, but they’ll have to at least have JavaScript available nonetheless. Can’t really backtrack on a browser standard like that. If people built serious apps that put optimized JavaScript to full, competitive use, then they’ll soon realize they’ll get much better performance by not using IE to run those apps if Microsoft doesn’t try to keep their own JavaScript engine optimized. Microsoft would either have to play their cards soon and attempt to force their SilverLight junk to become mainstream ASAP, or else concede territory and update their own JavaScript engine so as to not risk falling further behind in the browser race.

Not sure if this theory really holds any air, but it’d be interesting if that’s how it played out.

I’d laugh if someone made a proper 3d engine with only JavaScript, too. :P

46407cc1bdfbd2db4f6e8876d74f990a
0
Kenneth_Gorking 101 Sep 09, 2008 at 13:47

@Daddy Warbox

I’d laugh if someone made a proper 3d engine with only JavaScript, too. :P

http://www.devmaster.net/forums/showthread.php?t=12019

B5d5f89b052f80a875dd85427a116724
0
Daddy_Warbox 101 Sep 09, 2008 at 15:02

Holy shit! That’s not full-fledged 3d, but damn! And he did it with DOM manipulation, too.

A0c9c0649c5deacc0ae3b7f7721c94d2
0
starstutter 101 Sep 09, 2008 at 16:06

@Kenneth Gorking

http://www.devmaster.net/forums/showthread.php?t=12019

That thing was awesome but I had some serious trouble with it running =/
I’ll have to try it again, maybe it’s fixed now.

B5d5f89b052f80a875dd85427a116724
0
Daddy_Warbox 101 Sep 09, 2008 at 16:50

Try it in Chrome and see how fast it runs.

I think I need Quicktime in order to use Canvas. Alas I don’t have that either.

A0c9c0649c5deacc0ae3b7f7721c94d2
0
starstutter 101 Sep 09, 2008 at 17:00

actually it worked much better this time :) (not in chrome, IE)

When you think about it, that is pretty damn impressive to do that in javaScript of all things

B5d5f89b052f80a875dd85427a116724
0
Daddy_Warbox 101 Sep 13, 2008 at 15:31

Yeah. What could really stop JavaScript from being optimized to the degree of other optimized JIT languages, anyway?

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Sep 13, 2008 at 19:18

Well, one hurdle to highly optimized JS is that JS is a dynamically typed language, as opposed to Java or .NET languages, which are statically typed. Dynamic languages are always going to be slower at runtime due to the type checking they have to do.

It would be an interesting exercise, though, to try to build a static type inference system for JS, since I suspect that a good deal of the JS out there might be written in a statically-typed way, with a single identifiable type for each variable. You could use such an inference system to identify and eliminate many unnecessary run-time type checks.

B5d5f89b052f80a875dd85427a116724
0
Daddy_Warbox 101 Sep 13, 2008 at 21:28

Yeah. Does allowing the behavior of associative arrays also act as a slowdown? I’d imagine it would compared to numeric-only arrays of other languages…

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Sep 13, 2008 at 21:56

Associative arrays don’t need to be especially slow; they’re usually implemented as a hash table, which can be quite fast with a good hash function. It is true, though, that plain old integer-indexed arrays are handy to have for cases where you absolutely need to squeeze the last drop of performance out of a routine - for instance, in a rendering inner loop. :)

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 14, 2008 at 10:46

The whole rich internet applications seems a little overblown to me. Aside from you-tube, where are they? A bunch of blinky ads. The Flash games are great, but specialized also.

6837d514b487de395be51432d9cdd078
0
TheNut 179 Sep 14, 2008 at 13:48

I see Javascript as archaic glue code only. AJAX, XML/XSLT processing, condition statements, etc… Using it to develop web applications seems rather counter-productive. It’s not the easiest language to work with, it’s debugging support is non-existent to minimal, and it’s highly browser specific. A JS on one browser may not produce the same results on another. And with all the JS restrictions being implemented in browsers, it’s becoming more and more burdensome. At least with Flash and Silverlight you are dealing with a common base API and have many other options including socket support for external networking.

With the use of Flex & Action Script and new features soon to be released with Flash 10, Adobe has a solid product line going. There’s a lot you can do in Flash today that makes it a far more effective application builder than any other existing technology. Silverlight has potential, but they have a lot of work to do in order to catch up to Flash, at which point Adobe only has to worry about adding newer and better features. JS on the other hand is way to archaic of a language to develop with. At least from my experience. I keep JS to a minimum.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Sep 14, 2008 at 18:15

One thing that can be said for JS is that it works out of the box in all modern browsers. I used JS in my web apps (when I was a web developer) because I didn’t want to require users to have a third-party plugin - even one as widespread as Flash.

Also, I don’t think it’s as browser-specific as you imply. Back in the bad old days of the 90s it was, but I’ve built several web apps since 2004 and never had much trouble getting my JS to work in Firefox, Safari, and IE (the browsers I was interested in supporting). I was doing fairly sophisticated DOM and AJAX stuff, too. The language is clean and simple and there are a lot of resources on the Web to help you when things don’t go well.

For JS debugging support, check out this and this for Firefox, and this and this for IE.

B5d5f89b052f80a875dd85427a116724
0
Daddy_Warbox 101 Sep 14, 2008 at 19:35

I don’t think JavaScript’s eccentricities really damn the language from being usable for serious apps. I use it all the time, too, and I haven’t had any real problems with it.

But now that I think about it, in order to actually use JavaScript for any meaningful 3d rendering, there’d be no avoiding some form of 3rd party plugin to access hardware and stuff like that, which would kinda defeat the point of it being standardized for every browser…

Unless someone made a standardized plugin for JavaScript to access the hardware?

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 14, 2008 at 20:30

I didn’t want to require users to have a third-party plugin - even one as widespread as Flash.

It goes too far to expect that on the main parts of a page like menus, etc. There are some reason’s people don’t want or can’t use Flash, plus it is proprietary and can’t really be trusted. Maybe the price is all right for some, but I find it too expensive, although I’ll probably end up getting it to write some Flash games. They’re just another Microsoft sticking it to developers because they have a corner on the market.

6837d514b487de395be51432d9cdd078
0
TheNut 179 Sep 14, 2008 at 21:48

Also, I don’t think it’s as browser-specific as you imply… I was doing fairly sophisticated DOM and AJAX stuff, too

Ajax is a prime example ;) To process XML over HTTP in IE, you have to use:

ActiveXObject(“Microsoft.XMLHTTP”);

But with Firefox, you have to use

ActiveXObject(“Msxml2.XMLHTTP”);

That’s not the only instance either. I’ve had numerous issues with stylizing in JavaScript. IE supports alpha, Mozilla calls it opacity and refers to it in a different way. The whole thing is a mess. That’s why I dislike JavaScript in favor for more developer-friendly APIs like Flash. Which, fireside, is not as proprietary as you think. Flex is open source and offers many wonderful features (albeit far from perfect). Just plug the Flex SDK into Eclipse and you’ll have a full fledged Flash application or game in no time. Flash also has excellent market penetration (\~90% last I heard). Javascript can do a lot and it may be an out-of-the-box solution, but why go through the hard effort when there are far easier solutions out there? The only way my opinion will ever change on Javascript is if a company takes it over and truly standardizes it. Otherwise it’s just hack and slash programming.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 15, 2008 at 22:45

I didn’t know Flex was being used for games, but it appears that it is somewhat. I might look into that.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Sep 16, 2008 at 11:56

@starstutter

actually it worked much better this time :) (not in chrome, IE)

I haven’t touched it in a while now, so I doupt anything has changed since you last ran it. There are some bugs involved in changing the resolution / window size, and it appears to be nonfunctional for FF3.