Draw profiling

When building an app, I’d often like to know the performance cost of adding features, but as long as your frame rate stays at 60 per second, it’s impossible to know (I know I could write a little app that repeats the feature 1000000 times to see how long it takes, but when the feature is dependent on other parts of the app, it’s not easy).

I’ve been thinking about a profiling tool which could test performance in this case, by first calibrating the iPad by seeing how many iterations of some task (eg a math equation) can be performed before frame rate drops. Then the tool would run the user’s draw function, and (by iteration) find how many of the math tasks could be included before frame rate drops.

So if (say) the iPad can do 1,000,000 math iterations at 60 FPS, and this drops to 400,000 when the user’s draw function runs as well, then we can say that function is taking 60% of the draw cycle. We can also test the effect of adding features to see the marginal effect.

I haven’t figured the best way to manage the iterations, but I thought I’d share the idea to see what other people are doing.

what about os.clock()? you get micro second measurements, so you dont have to make loops. Doesnt work for grafic processor, though.

Graphics is what you need it for most

Hi @Ignatz,

There is the profiler class we wrote here:

http://codea.io/talk/discussion/4498/profiler4codea-a-simple-profiling-tool

You can get stats for any objects and its functions, number of calls, time taken etc.,

Brookesi