View Full Version : Which is faster Javascript or Actionscript
matak
12-07-2007, 03:36 PM
Hy all,
I'm trying to select client side language to learn. For some time i wanted to learn Javascript, but when i tried writing first script which was so simple, i saw that it has so much problems. I thought of flash, and read few tutorials online. It's pretty simple but powerful language.
I know that probably worst feature of flash is that it's not included by default in your browser, but since youtube and other video sharing services i think that flash players on browsers are drastically more installed then before, and that almost everybody has it.
Now, i'm planning to create chat for my personal website, and i saw Ajax chats, and Flash chats. Since i don't have experience with any of the scripts i'm wondering which code is faster
Properly written Javascript, or Actionscript.
Also, which of these languages are better for me to learn. I'm learning web programming as hobby so don't use money as argument. But which of those two can be used for creating fun, dynamic, fast and safe programs easily
VIPStephan
12-07-2007, 03:55 PM
ActionScript is just a derivate/dialect of JavaScript (i.e. both are implementations of ECMAScript (http://en.wikipedia.org/wiki/ECMAScript)). Basically you could say ActionScript is for Flash what JavaScript is for web browers (among other programs). So while there are differences I’d say that learning either of them requires an equal effort.
Which one you wanna use depends on what kind of programs you want to develop. With Flash (ActionScript) you can create powerful interactive programs and with JavaScript you can… well, create powerful interactive programs. One difference is that JavaScript is open source and Flash is proprietary to Adobe (since they bought Macromedia).
I guess the graphic/design component makes Flash a little better for advanced animations etc. because there you can work with and manipulate vectors (although it might be interesting to work with SVG and JavaScript in a similar way).
I’m not a JS or AS guru at all but these are the things I can think of. Feel free to prove me wrong.
matak
12-07-2007, 05:50 PM
(although it might be interesting to work with SVG and JavaScript in a similar way).
i know it might be interesting. that is only reason why i didn't decide what to use yet ;).
you mentioned what kind of applications interest me. i mentioned in post above, that i'm interested in web chat application (something like Ajax shoutbox which could be found on many websites). maybe later i could use knowledge in AS to develop simple multiplayer online games (something like Runescape (made with Java).
i just don't know what is faster. eg. let's say we have same ammount of users chating in Flash/Actionscript or Ajax shoutbox. Which one would behave better (both in combination with flat file (eg. XML), PHP and MySQL used for server side part
felgall
12-07-2007, 09:30 PM
This sounds like a "which is faster - red cars or blue cars?" kind of question. The speed in each case will depend on the particular browser or Flash implementation that your visitor uses to run it - whichever one has the faster interpretor for running the script will run faster (the same way the car with the most powerful engine regardless of colour will run faster). Of course there are more people without Flash than there are without JavaScript.
matak
12-08-2007, 02:08 AM
so, that what your saying is like, both languages are the same in case of performance!?
liorean
12-08-2007, 03:16 AM
so, that what your saying is like, both languages are the same in case of performance!?Well, the truth is more like this:
JavaScript and ActionScript are ECMAScript, thus they have performance limitations that look roughtly the same.
However, ActionScript 3 is typically much faster than JavaScript if you use the ActionScript 3 type annotation system and classes that can be found in ActionScript. This is because the type annotations and class hierarchy systems allows for optimising the generated code better.
If you use untyped code, then it's likely that most of the ECMAScript implementations that you can find in a browser are on par with ActionScript 3.
However, then you have to add the host environment. The host environment speed is very dependent on which browser you're using. Opera and Safari have very good performance for both untyped regular ECMAScript and for host environment. Firefox has mediocre regular ECMAScript performance and fast host. Ie has average ECMAScript performance and occasionally slow, occasionally fast host objects, usually the former.
Flash has it's own very different host. It's not really productive to compare the hosts, however, because they are not made for the same kind of things.
felgall
12-08-2007, 11:12 PM
Well I am still waiting for a one line actionscript in a web page I loaded last year to start to run, my browser has run millions of lines of JavaScript during that same time period. Therefore in my browser JavaScript is billions of times faster than actionscript. Must be the way I have my browser configured.
kingtas
12-10-2007, 06:14 PM
I would think that Javascript should run faster because of the Flash overhead Actionscript requires?
matak
12-11-2007, 08:30 AM
Well I am still waiting for a one line actionscript in a web page I loaded last year to start to run, my browser has run millions of lines of JavaScript during that same time period. Therefore in my browser JavaScript is billions of times faster than actionscript. Must be the way I have my browser configured.
don't get me wrong, but i see no sense in what you are trying to say :confused:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.