PDA

View Full Version : AS3 and Haxe


danilo2
03-16-2009, 03:59 PM
Hi, I'm currently building a big website application in which I'll be using a lot of bitmap blitting, math operations and so on. So EVERY optimalisation will help my app be better.
Today I was reading a lot about haxe - some people says that it is faster, some that slower than AS3 hmmm But I couldn't find actuall topic (this is almost all topics "as3 vs haxe" were written in 2007) So I have question for you - Is haxe really faster than Actionscript3? (Of course I will write in Haxe in "haxeactionscript" not cor another language).

If it is faster, than, please write me what exactly can i get better in it
Thank You very much and I'm waiting for Your's reply

JLM
03-16-2009, 04:49 PM
Haxe supports some Alchemy opto codes that as3 does not currently support
http://www.ncannasse.fr/blog/virtual_memory_api
I am not sure that 3D has found much speed increase through using them due to how they have to be used.

FastList's are faster than arrays. And stricter typing structures allow more speed.

XML parsing seems to be easier to do fast in AS3?

I really don't think though there is a huge difference between haXe and AS3 most of the time as its all ABC it probably as much down to the coder or libraries available, the real differences are when you get neko to process it backend, and don't have to re-code the classes, I mean if you change player or browser it will as lightly or not change the speed more.

With all things you need to do real experiments as theory is not the same as practice.

But if you have some real algorithms post them somebody might be able to give qualitative advice and I would not be surprised if they could be made to run faster in haxe.

danilo2
03-16-2009, 09:14 PM
Thanks for your reply! :) I hope, that (in most cases) when I will be programming in Haxe it would be faster and not slower than in as3 :) I'll make some tests and I'll publish the results maybe in a week or so.

Ok so I've got another question - when it comes to blitting, does anyone have idea if I could use this "super abilites" of haxe to draw (or copy) pixels between bitmaps? :confused:

edit: And additional - anybody knows where can I get Haxe manual?On this site: http://haxe.org/api I think the manual is old (most of examples are connected with AS2 (fe. movieClip's properties _x and _y, and in real compile the x and y properties are working). Additional there are not all classes, fe. flash.memory :confused:

JLM
03-17-2009, 09:35 AM
There is a lot of info on the site, you just need to look round.. for instance I created some simple flash9 examples
http://www.haxe.org/byexample

But there are some really good examples that Nicolas has posted and there is lots on his blog, I will ask the list about a blog link list, and if I get a list together I will post it back here.

The community is important have a look through lib.haxe.org its where you can see different approaches to code for example
MassLoader, SWFAddress, sandy, physaxe, feffects TweenerHX, facebridgex etc...

the haxe book is kind of a must have covering basic language use it might be online now but a small investment to save you time.

JLM
03-17-2009, 10:05 AM
sorry without trying the virtual_memory_api I can't answer your question on blitting copying pixels but would imagine it could be used in connection.

JLM
03-17-2009, 10:14 AM
I think you can download ChxDoc from http://www.codeblackbox.com/ and it provides documentation for your projects and also haxe eg...
http://www.codeblackbox.com/chxdoc_sample/doc_user/index.html
http://www.codeblackbox.com/chxdoc_sample/doc_developer/index.html

danilo2
03-17-2009, 11:32 PM
JLM thank you really very much!
I see, that haxe language is really similar to AS3 ( :mad: but haxe doesnt have WITH keyword and INTERNAL :P )

So here goes my last question:
Does somebody have an idea how to connect virtual_memory_api with bitmaps? (I know only one method to convert byteArray to Bitmap -> throught Loader.loadBytes -> convert to bitmapData, but I hope thereisafaster one :) )

danilo2
03-19-2009, 09:29 PM
So does anybody knew what to do to speed up working with bitmap data using haxe?
I really please about answer if it is possible :)
Thank You verymuch and I'm waiting for Your's reply :)

Amn
04-18-2009, 01:31 PM
Nicolas himself (the author of haXe) had found out that tweaking haXe and using virtual memory api (opcodes not used by Flash/Flex yet) he had mocked up an inverse square root function which was %686 percent faster than whatever he could produce with AS3 and Flash/Flex. I.e. more than 6 times faster.

There are also inline functions which can speed up things really well, I guess depending on the context up to 3 times too, who knows. There is, again, the virtual memory API, which is another way to do bitmaps among other things, but about 1.5 times faster than the Bitmap classes themselves.

There are more things, and you can read about them on haXe's website.

If you do 3d, you will probably on average be twice as fast as whatever folks with AS3 can do these days, because of all the small things you can optimize in haXe that you cannot do anything about with AS3 and the compilers Adobe has.

And, haXe has been faster than the rest for a good half year now. But the documentation is still subpar. And it hurts bad...