Gathering debugging information is useful for correcting errors but it requires memory and compute resources. However the process of gathering debugging information typically has a negative impact on performance.
Ensure you switch off debugging before releasing your application. For other pre-release checks, see Final release check list.
- Use minimal
printf()calls can be very slow. You can prevent them from impacting application performance by only displaying the frame rate after a relatively large number of frames. For example, make a
printf()call every 100 frames, not one every second or one every frame.
- Do not call
glGetError()more than one time per frame
Every call to
glGetError()takes time to process. A large number of these per frame consumes sufficient compute resources to limit the frame rate of the application. Ensure you make no more than one
glGetError()call per frame.
You can use
#definemacros to build the debug code for development builds and remove it for release builds.
If the application is gathering debugging information while taking measurements, these measurements are likely to be inaccurate.