C++ Code Optimization – Optimizing a Particle System

In the fall quarter of 2013 at DePaul University, I took the GAM491 – Optimized C++ class. In this class we learned very advanced techniques to optimize any C++ code. As a final project, we were provided with an old and slow particle system. Each student was required to individually submit an optimized version of it applying as many techniques of what we have studied as possible. The rules were:

  • Keep the number of particles at 20000 for the benchmarks.
  • Keep the particles lifetime at 11 seconds.
  • Do not modify any OpenGL calls, just the modification of theĀ  C++ code, the algorithms and the data structures used were allowed.
  • Do not change any of the particle system behavior.

The results of the optimizations that I made were impressive. They are shown below (an improvement by a factor of about 160 times):

Before

Before - Particle System

Before – Particle System

After

After - Particle System

After – Particle System

Advertisements