Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Triangle performance problem



Hi Paul,

I removed glBegin, it was in some virtualization debug code, which I've updated to use glDrawArrays.

I also made it so the app is constantly drawing 6000 of the triangles, so that we can see a good sample of the worst case scenario.

Here is an example. It said my app was in OpenGL 48% of the time:

GL Function # of Calls Total Time (µsec) Avg Time (µsec) % GL Time % App Time
CGLFlushDrawable 2,364 26741655 11312.04 82.81 39.54
glDrawArrays 7,988 3825748 478.94 11.85 5.66
glDrawElements 11,339 550065 48.51 1.70 0.81
glTexSubImage2D 2,007 461869 230.13 1.43 0.68
glClear 2,364 239508 101.31 0.74 0.35
glPopAttrib 18,460 126857 6.87 0.39 0.19
glPopClientAttrib 16,096 112162 6.97 0.35 0.17
glPushAttrib 18,460 85439 4.63 0.26 0.13
glTexParameteri 48,299 16946 0.35 0.05 0.03
glTexImage2D 7 13480 1925.73 0.04 0.02
glColor3fv 59 13089 221.86 0.04 0.02
glPushClientAttrib 16,096 13087 0.81 0.04 0.02
glEnableClientState 47,652 9859 0.21 0.03 0.01
glEnable 36,173 8866 0.25 0.03 0.01
glDisable 26,462 8320 0.31 0.03 0.01

Does this help? Can you help me to understand what this means?

Also, I've been profiling my application using shark. I've found that the function that updates the arrays is also taking up a lot of time, but typically not long to cause any performance problems (although I will need to improve the speed).

While benchmarking the application, simply commending out the glDrawArrays call (and leaving everything else in-tact) made things generally as fast as expected (60FPS).

Thanks everyone for your useful suggestions,
Samuel



On 18/05/2009, at 10:33 PM, Paul Sargent wrote:


On 18 May 2009, at 10:59, Space Ship Traveller wrote:

Here are some details from the OpenGL Profiler I managed to figure out some things (I just included the top 5 as all the other ones are not that interesting):

GL Function # of Calls Total Time (µsec) Avg Time (µsec) % GL Time % App Time
CGLFlushDrawable 1,265 4087917 3231.56 82.08 6.86
glDrawArrays 2,106 260195 123.55 5.22 0.44
glBegin 14,525 140308 9.66 2.82 0.24
glClear 1,265 139147 110.00 2.79 0.23
glDrawElements 3,398 121990 35.90 2.45 0.20

So, from this I can see that glDrawArrays is taking up 5% of OpenGL time.

... and 0.44% of the App time. If you got this time to zero you'd be speeding up your application by 0.44%.
This is not what is limiting your performance, it's the 93% of CPU time spent outside of OpenGL (100% - 7% App Time)

What is OpenGL time? Is that the time my process spends in the OpenGL library?

Yep, exactly... and app time is the time spent in your whole application. At the moment only 7% of your time is spent in OpenGL.

Is there any documentation about how to make this faster? Is this considered slow?

I'd say you need to be looking outside of your drawing code. Try firing up Shark and see what that tells you.

Paul

BTW: working those numbers backwards. I'll assume this was 1,265 frames (i.e. one clear, and one flush per frame)

Thats 

1->2 glDrawArrays per frame
2 -> 3 glDrawElements per frame
11->12 glBegins per frame

A. Your not giving OpenGL much work to do, so extrapolating performance is not really valid.
B. Your code has glBegins in it, so it's not on a fast path.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden

References: 
 >Triangle performance problem (From: Space Ship Traveller <email@hidden>)
 >Re: Triangle performance problem (From: Steven Canfield <email@hidden>)
 >Re: Triangle performance problem (From: Space Ship Traveller <email@hidden>)
 >Re: Triangle performance problem (From: Paul Sargent <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.