I tried to make a (really simple) ram speed benchmark code in C.
I noticed that the speed calculated by my code differs from the one of tmpfs and the one in memtest.
The difference between the 3 is really huge,
The system is a Phenom X4 9950 with 4GB DDR2 800Mhz (2x2GB) running on Ubuntu 12.04.3 (updated so kernel 3.8.0-30-generic)
to check tmpfs write speed i used:
dd if=/dev/zero of=test count=2048 bs=1M
memtest speed is just the speed of ram displayed
my program is just a malloc of 2gb and 10 times a sequential write with blocks of 16k of zeros ( i tryed out 1k , 2k, 4k, 8k too but i have no idea why this size is the one that gives the best performance)
I tested ganged and unganged mode for all three benchmarks
Unganged mode is the fasest
mycode: 1157.06 MB/s
mycode: 1164.63 MB/s
There are nearly no performance differences between the two modes. I checked multiple times and i always had these values.
I expect to be some overhead on tmpfs related to my benchmark but it's actually faster.
I expected memtest to be faster than the other 2 benchmarks but not over the double of their speed.
I was now wondering if someone could explain my results, because i have the feeling they show some interesting feature of linux/Ubuntu architecture.