A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: the POWER of AS3

  1. #1
    Senior Member
    Join Date
    May 2006
    Posts
    145

    the POWER of AS3

    yup as the title says

    AS3 is better, I know that
    it is more oop and thus is better for programming in some sort, yes I know that
    it is oop and run on a new player and about 10x faster, really?

    but honestly, I havent feel the power of AS3
    is it really faster? people say yes, but i never encounter any formal experiment of proof that it is faster.
    Is it better? I am learning AS3 and yes, to an extent it makes your codes twice longer, much less messier.
    but overall, if AS3 is oop, like c++, why it cannot be very fast, like c++, and see people start creating half-life3 and DOOM with AS3?

  2. #2
    Well yes AS3 is much faster, just do a few tests using loops with AS2 and AS3 and time them, there is a huge difference. I don't think AS3 is faster because of object orientation alone. It is mainly faster because it is run using an entirely new virtual machine, and the developers just wanted it to be like more Java and organized by using object oriented techniques, I think.

    AS3 will probably never be near as fast as C++ because programming languages like C++ deal with the computer directly one on one(or close to it). Programming languages like AS3 and Java have to go through a translator(it's Virtual Machine) every time they want to do something, and like real life that slows things down significantly, but the benefit is mass usability of the finished product on whatever machines the translator(virtual machine) can talk to.

    I'm pretty sure though that is was the new Virtual Machine that made AS3 much quicker than AS2, not necessarily it's implementation of OOP, though OOP did make it much nicer in respect to design, in my opinion.

  3. #3
    Senior Member
    Join Date
    Sep 2005
    Location
    Detroit
    Posts
    193
    Also by being stricter most runtime errors are handled and dealt with before you deploy them onto the Web. I would say that the strict declarations is the OOP speed difference between AS3 and AS2. AS2 was Object Oriented too, just sometimes the program didn't know what object it was orienting to.
    While the music played you worked by candlelight
    Those san francisco nights
    You were the best in town
    Just by chance you crossed the diamond with the pearl
    You turned it on the world
    That’s when you turned the world around

  4. #4
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    Quote Originally Posted by ArielGenesis
    but overall, if AS3 is oop, like c++, why it cannot be very fast, like c++, and see people start creating half-life3 and DOOM with AS3?
    http://blog.brokenfunction.com/2007/...sh-plays-doom/

  5. #5
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    OOP has nothing to do with speed. OOP actually makes code run slower.

    C++ is compiled, AS is interpreted (and slowly at that).

    No, people aren't going to create half-life 3 and Doom with actionscript (unless the version is 10 years old).
    The greatest pleasure in life is doing what people say you cannot do.
    - Walter Bagehot
    The height of cleverness is to be able to conceal it.
    - Francois de La Rochefoucauld

  6. #6
    Senior Member
    Join Date
    May 2006
    Posts
    145
    ooooohhhhhhh there is?
    wow that's cool, very nostalgic, well I was talking about DOOM 3

    so AS3 is having the player talking with the OS instead the machine directly which make it slower. get it. so if someone builds a compiler that have AS3 talking to the machine direct it will be faster? or wait, is it possible?

    and so the rest are just having a better language for programmer...

    well you just post it a second before me! 6.......

    well so C is compiled and AS is interpreted, what's the difference?
    Last edited by ArielGenesis; 09-12-2007 at 06:24 PM.

  7. #7
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Flash runs in what is called a virtual machine. That is, the flash player simulates a piece of hardware which runs the flash bytecode. The traditional difference between compiled and interpreted is that a compiled program is one which is turned into machine instructions, whereas an interpreted program is run by an interpreting engine. Javascript is a purely interpreted language.

    Actionscript and Java are somewhere between. They are compiled to bytecode which is machine instructions, but the machine instructions are for a fictitious machine which is simulated in software. This is of course slower than native OS/hardware instructions. The major positive is that it's extremely portable. My Java and Flash programs can run on any platform which has a virtual machine written for it.

  8. #8
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    Don't think that Actionscript is anywhere near the level of Java though. Java is still at least a few hundred times faster than AS.

    I don't think flash will ever become super fast, because, frankly, if you are going to be programming something on the scale of half life, why would you do it in flash?
    The greatest pleasure in life is doing what people say you cannot do.
    - Walter Bagehot
    The height of cleverness is to be able to conceal it.
    - Francois de La Rochefoucauld

  9. #9
    Senior Member
    Join Date
    May 2006
    Posts
    145
    oooh I see, portability. that's what made AS is soooooooo great. but speed it the cost.

    so c++ cannot be run on any platform? hum...

  10. #10
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    Yeah, and being able to be run inside a browser also costs speed.

    C++ can be run on any platform, if you are willing to recode a bit, and re-compile it for each one...
    The greatest pleasure in life is doing what people say you cannot do.
    - Walter Bagehot
    The height of cleverness is to be able to conceal it.
    - Francois de La Rochefoucauld

  11. #11
    Senior Member
    Join Date
    May 2006
    Posts
    145
    oooh
    so complied c++ cannot be run on any platform
    to run on different platform, it have to be recompile, and minor necessary recoding.

    why cant AS be complied instead of interpreted?

    somewhere in my mind i could hearing people say:
    "you noob, of course! IT IS THE WAY IT IS"

    but seriously, and honestly, I don't understand the difference. I learned very basic c, not c++ and also VB, self taught, and fail, PASCAL and of course, AS2&3. and I cant help my self to found that AS3 to look very similar to c++ n VB. So logically, according to my bent logic of course, it should be able to be complied into assembly language and run at its full speed. Of course then you cannot have it on web, it have to be downloaded, and may be installed, but technically, could you compile AS3?

  12. #12
    Senior Member
    Join Date
    Sep 2005
    Location
    Detroit
    Posts
    193
    You can't run C inside of a browser you would instead need to run it from your local machine. C interacts directly witht he machine. Java and Flash work directly with the Java Plugin or interface and Flash Player. These are virtual machines that are interacting with the flash code you write. C is meant to run directly on the machine and if served dynamically over the Web there could be some real problems. But then a lot of people use these languages as on the server side.

    Think of it this way. Flash and Java programs are like complicated JPGs. You need another program to display them. C, python, etc. can program things like firefox, that can run natively on your computer without another program supporting them.

    Also AS3 is compiled. It is just not comiled for your machine. It is compiled for the flash player to interpret it onto your computer.
    While the music played you worked by candlelight
    Those san francisco nights
    You were the best in town
    Just by chance you crossed the diamond with the pearl
    You turned it on the world
    That’s when you turned the world around

  13. #13
    Junior Member
    Join Date
    Dec 2000
    Posts
    5
    I think one of the things that make as3 faster is strict typing... but that isn't mandatory so if you don't use it maybe you don't get much better performance

  14. #14
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    A language in itself isn't compiled or run in a VM, it was just designed to be used that way.

    For example, Java is generally run in its VM, however if you want, there are (expensive) compilers available for it. These don't work well (lots of bugs) but they exist. The issue here though, is why? If you wanted a compiled program, you shouldn't be using Java.

    I am sure that someone sometime has tried to write a virtual machine for C++, but there isn't really a point, since C++ isn't designed that way, and you would probbably break most of it.

    Another issue here is that no matter how similar the syntax looks, most languages have fundamental differences in their structure. C++ and Java are like night and day structure wise. Actionscript follows Java structure.

    Things like multiple inheritance and pointers are included in C++. A C++ program is a function, while both Java and Actionscript are classes. There are plenty of very fundamental structural differences between the way the compiled and bytecoded languages are structured.

    Finally, writing a compiler for flash would be a complete waste of time because:
    A. Flash doesn't handle any drawing itself, you would be writing a massive wrapper around the program, which is going to slow it down a lot.
    B. You kill the entire point of flash.
    C. Flash cannot compete with real languages.
    D. Flash was never designed to be compiled, and won't go through the process any better than Java does.
    Last edited by 691175002; 09-13-2007 at 06:44 PM.
    The greatest pleasure in life is doing what people say you cannot do.
    - Walter Bagehot
    The height of cleverness is to be able to conceal it.
    - Francois de La Rochefoucauld

  15. #15
    Senior Member
    Join Date
    May 2006
    Posts
    145
    oooohhhh I see now...
    I feel enlightened!
    It's do able, its just ridiculous... I see...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center