Memory RAM usage

bearophile bearophileHUGS at lycos.com
Wed Dec 30 16:49:00 PST 2009


Today PCs have lot of RAM, so reducing the memory used by a program may seem not so important, but practice shows that reducing the memory used by a program reduces the cache traffic and increases cache coherence, so the code runs faster (I have recently seen a 13X speedup in a not synthetic program just modifying how memory is used and reducing memory usage, keeping the same algorithm. I can show you an URL if you want). So reducing memory (and improving cache usage patterns) is very important for D programs that want to run fast.

Do you know how can Free Pascal use so little RAM? Here in this nbody benchmark (a simple N body gravitational simulation) it seems to use less than half of the memory used by C, yet the C code is tight and clean enough, and both use 64 bit floating point numbers:
http://shootout.alioth.debian.org/u32q/benchmark.php?test=nbody&lang=all&sort=kb
In other benchmarks memory usage of Free Pascal is not dramatically lower, but it's usually near the top of lower memory usage in all Shootout benchmarks.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list