Performance Profiling

So I ran Very Sleepy on the Squares game. Really it was just out of idle curiosity, since I’m having zero performance issues. I’ve often thought that the best optimization is not asking the hardware to do very much in the first place, and I’m definitely doing that here.
Anyway, Very Sleepy showed what I suspected, that SDL_Delay() was taking the majority of the time of the application.

What troubles me is that SDL_Delay() was only taking ~70% of the time. That’s worrying. Since the game runs at 100 fps that means we have 10 ms of processing time per frame. Considering how basic the game is as of right now, 3ms, while pretty great, is actually much slower than I thought it would be.

Luckily, Very Sleepy breaks down which functions are taking the most time. After Sleep, called by SDL_Delay(int x), we have SDL_SetTimer. I have no idea what SDL_SetTimer even does, let alone why it’s taking 10.43% of my processing time. That means this 1 function is taking over 1 ms of my precious processing time each frame just to do something. I can only assume that it’s use is in using the gameclocks I’ve set up. I need to look into the SDL documentation here.

After that, we have ApplySurface(vars), which uses10.7% of my processing time. Totally understandable. Especially since I’m still using a software renderer. It’s pretty great to have the rendering portion of my game only taking 1.07 ms per frame.

This was mostly to familiarize myself with simple profiling tools. Even then it turned up something interesting.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s