digitalmars.D.learn - Memory RAM usage
- bearophile (6/6) Dec 30 2009 Today PCs have lot of RAM, so reducing the memory used by a program may ...
- grauzone (5/11) Dec 31 2009 No idea. I just know that FPC doesn't use GCC. I think it doesn't even
- bearophile (4/5) Dec 31 2009 http://leonardo-m.livejournal.com/91798.html
- BCS (6/17) Dec 31 2009 If that's the root, then it may well be a fictitious benefit because it ...
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
Dec 30 2009
bearophile wrote:(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).Yes, please do!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.No idea. I just know that FPC doesn't use GCC. I think it doesn't even link to libc! (I can't really confirm, ldd crashes on the executable produced by fpc.) Maybe it just avoids some constant overhead due to this.Bye, bearophile
Dec 31 2009
grauzone:Yes, please do!http://leonardo-m.livejournal.com/91798.html Bye, bearophile
Dec 31 2009
Hello grauzone,bearophile wrote:If that's the root, then it may well be a fictitious benefit because it may well have no effect on the resident set size (the amount of RAM actually used) during the main processing. All that it would be doing is to no include at all code that the C version never pulls off disk (executables lazy load on most systems).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.No idea. I just know that FPC doesn't use GCC. I think it doesn't even link to libc! (I can't really confirm, ldd crashes on the executable produced by fpc.) Maybe it just avoids some constant overhead due to this.
Dec 31 2009