Importance of memory organization for speed
Bill Cox
bill at billrocks.org
Mon Jun 9 23:32:46 PDT 2008
Hi, all.
Waaay back, there was a short discussion of optimizing memory layout for speed. I've written a simple benchmark that traverses large graphs, one written in very carefully memory optimized C, the other using C++/STL. The C version is 15X faster, and uses 2X less memory on my Ubuntu x64 Core Duo laptop. Cachegrind shows the C version has a 16.7X lower L2 cache miss rate, which accounts for the speed difference.
So, I'll just post again the importance of keeping memory layout abstract, and hidden from the user. More and more, speed for memory intensive applications is all about cache performance. Benchmarks can be found in the examples/graph_benchmark directory of svn for the datadraw project:
svn co https://datadraw.svn.sourceforge.net/svnroot/datadraw/trunk datadraw
Best regards,
Bill
More information about the Digitalmars-d
mailing list