views:

1396

answers:

2

Is there any way or tool available that can profile AS3 code without using Flex?

How can I profile existing project written in Flash CS3 and AS3?

+1  A: 

Flex is actually a framework. I think what you mean is Flex Builder, which is an IDE containing a built-in profiler.

It also depends on what information you want want to profile. Memory Usage, CPU performance, the number of times a particular function is called ... these are all different metrics.

For memory you can use System.totalMemory. CPU usage is not really as important for Flash as framerate (which is an indirect CPU usage metric). There are many ways to measure framerate but I usually search Google for a library and then use it. Something like Hi-ReS! Stats or AS3 SWF Profiler. There are thousands of them around.

As for other metrics ... well you have to be specific. If you want to find out things like "Which function is taking the longest amount of time to execute?" then you might just have to get your hands dirty and put Timers in your code ... IOW instrument your code by hand.

James Fassett
+1  A: 

I would recommend flash guru Grant Skinner's performance profiler

"Point it at an instance of a class, and it will test all the public methods on it. Or, use properties or parameters to formalize the tests with names, descriptions, and specific method lists.

You can even use PerformanceTest to test the render time for complex vectors or filters.

You can also easily customize how it logs the results of tests to output them differently, save them to a file, or graph the results.

http://www.gskinner.com/blog/archives/2009/04/as3_performance.html

Allan