G
gpderetta
Well, now you see, this is nearly the same problem as with your Java
flags...
Exactly my point .
And btw, you can make N up to the max virtual memory size on your
machine. No need to fine tune for the exact N of your program.
Also, no memory wasted, any modern (read: written in the last 30
years) will fault in memory on demand, so you waste 0 bytes (modulo
the page granularity).
Razii, did you try my version with __attribute__((pure)) (http://
pastebin.com/m76543e97)?
A good compiler with powerful intraprocedural optimizations could
figure out the attribute by itself, for real life compilers we have to
help them a bit.
If tried the same program in haskel, you would also get Time:0, for
whaterver n you could immagine (even some order of magnitude more than
your phisical memory). That's to prove that testing how fast you can
make a program that does nothing makes absolutely no sense.
My purpose (other than having fun) is not to show that C++ is faster
than java or viceversa, but simply that benchmarking is hard. This
benchmark is simply useless and is not benchmarking at all how costly
is dynamic allocation, but simply how good is a specific compiler at
interprocedural optimizations.