Sponsored By

In Gamasutra's latest section-specific feature, veteran Noel Llopis <a href="<a href=http://www.gamasutra.com/view/feature/3942/data_alignment_part_1.php>">tackles the topic of data alignment</a>, offering solutions that can lead to real-world performance

March 6, 2009

1 Min Read

Author: by Staff

In Gamasutra's latest section-specific feature, veteran Noel Llopis tackles the topic of data alignment, offering solutions that can lead to real-world performance increases in games. As Llopis explains in the programming-specific article, originally published in sister Game Developer magazine last year: "Data alignment refers to where data is located in memory... We care about alignment for a single reason: Performance." "In modern hardware, memory can only be accessed on particular boundaries. Trying to read data from an unaligned memory address can result in two reads from main memory plus some logic to combine the data and present it to the user," he says. "Considering how slow main memory access is, that can be a major performance hit." While Llopis warns that these solutions only apply to low-level languages like C and assembly, the article provides solutions -- despite what he identifies as C's drawbacks: "The C/C++ language falls short again, without a standard way of dealing with alignment." "Not only that, but we'll need to use different strategies to align data depending on how it is allocated: statically, on the heap, or on the stack. We're left at the mercy of compiler-specific extensions and our own home-brewed solutions." You can now read the full article on the subject, posted here as a Gamasutra feature, to learn the secrets -- including code samples and a diagram to illustrate the problem. The follow-up article, Data Alignment: Part 2, will appear on Gamasutra in the near future.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like