Importance of memory organization for speed

renoX renosky at free.fr
Fri Jun 13 23:42:03 PDT 2008


Bill Cox a écrit :
> 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.

Uh? What you just did is using your knowledge of the memory layout in C 
to speedup your app, so it's the *opposite* of having the memory layout 
hidden from the user!

I don't catch your point here..

Regards,
renoX


>  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