Coding Optimization


There is no need for optimizing software for performance to be a daunting task. In fact, there are a number of techniques that can be utilized in order to increase the performance of an open source game engine. These include:

1. Profiling- Profiling is one of the most important steps to take when optimizing your code because it lets you know what portion of the code to target. Creating a profile will help you save time by helping you target the portion of code that is executed the heaviest. If you are looking for a helpful tool for profiling application time, check out the Intel VTune Performance Analyzer. This tool will provide you with detailed information concerning the modules of the entire system.

2. SIMD Optimizations- SIMD stands for Single Instruction Multiple Data and is essentially a program that is able to operate on several pieces of data all at one. These sets of instructions operate on double-precision floating-point, single-precision floating-point, and integer data. Because these instructions can operate on multiple pieces of data at one time, they are able to execute certain algorithms quicker than the standard single data instructions. This method is often seen in gaming as demonstrated on .

3. Threading- 3D game engines are very complex and place stress on every aspect of the system. When they are running, their complexity tends to grow depended on the amount of computing power that is available to them. So far, industry trends in performance have evolved from pure frequency to multi-core/multi=processor systems. In order to take advantage of these multiple cores, #3D games need to be designed for parallelism:

Task parallelism- Tasks that need to get done (functional decomposition). Game systems are made up of many complex subsystems and some of these subsystems can be executed in parallel multiple threads (task parallelism). In most games, these subsystems are often coupled with numerous interrelated dependencies. Therefore, care should be taken to structure the engine in such a way that it reduces its dependencies on the various subsystems which will reduce the synchronization needed and maximize the benefit of parallel execution.

Data parallelism- Data that gets worked on (data decomposition. This occurs when the same independent operations are applied to different subsection of data in parallel. This method can be applied to different subsystems over a period of time.

Pipelined Parallelism- The flow of data (producer-consumer decomposition)- Sometimes data dependencies occur between tasks that cannot be eliminated. There are several ways to solve this problem but the best way to do so is to work around the data dependency and decompose the problem. This is achieved when the output of the producer becomes the input of the consumer. The consumer thread waits until the producer thread starts generating output and then it will start executing serially until data is loaded. Once this is accomplished, the thread will assume parallel execution.

code optimization