C++ Performance woes

I mentioned the other day how random players averaged about 1,000 games per second on my computer.

It’s been a while since I worked in C++, but that number seemed rather low to me, so I went back to my C# codebase and ran some tests… It averaged around 15,000 games per second. Keep in mind, that was NOT an optimized library, it was a rather straight-forward implementation in .Net. So, obviously something was amiss.

Going back to my C++ implementation, I realized I’d been passing some structures around by value instead of reference. Just throwing a few ‘const &’s in there gave me a decent speed increase up to 6,500 games per second. Good, but still not great. A few more ‘const &’s got me up to 7,100.

Before I commence with the rest of this project, I’m going to spend some time tuning this library. I want to at least match the performance of the .Net version, although I’d prefer to surpass it.

This is what I get for not working in C++ for so long.


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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