# RAM speeds -- where is that superfast memory?!

## KarlisRepsons

As wikipedia say for peak transfer rate:

DDR2-800 	200 MHz 	5 ns 	400 MHz 	800 Million 	PC2-6400 	6400 MB/s

mkdir ram0

mkdir ram1

mount -t ramfs -o size=400m ramfs /mnt/ram0

mount -t ramfs -o size=400m ramfs /mnt/ram1

dd if=/dev/sda of=/mnt/ram0/f bs=1M count=350

dd if=/mnt/ram0/f of=/mnt/ram1/f bs=512K

700+0 records in

700+0 records out

367001600 bytes (367 MB) copied, 0.237839 s, 1.5 GB/s

----------

## ssmaxss

Overhead of ramfs? For me with DDR2-800/CL6 it jumps from 500MB/s to 1.1GB/s with compilation in background. Maybe speedstep is doing something. Do you have Intel CPU? Interesting how will AMD CPU with integrated memory controller will perform.

----------

## KarlisRepsons

Yes, Intel, if that matters.

----------

## ssmaxss

It seems to me that it matters. AMD has integrated memory controller, it should boost performance of memory operations. Intel integrated it only in i7. Somebody with AMD CPU could try to run the same test?

----------

## energyman76b

try a 4k block size.

----------

## button

 *ssmaxss wrote:*   

> Somebody with AMD CPU could try to run the same test?

 

AMD Athlon64 3200+, s939, 2GB DDR400, DFI Infinity nForce4 MBO

```

367001600 bytes (367 MB) copied, 1,00377 s, 366 MB/s

```

There must be something wrong with my system, I will try to rerun the test later on idle computer, this one was run with a few parallel downloads running in background.

----------

## KarlisRepsons

dd if=/mnt/ram0/f of=/mnt/ram1/f bs=4K

89600+0 records in

89600+0 records out

367001600 bytes (367 MB) copied, 0.278215 s, 1.3 GB/s

----------

## KarlisRepsons

Also is quite strange, that memtest86+ shows approx. half of the peek speed. DDR? Well, why should I care about the technology, if it performs like that? Or is a misunderstanding in what memtest is showing?

----------

## energyman76b

don't forget dd is slow  :Wink: 

----------

## KarlisRepsons

Slow?? What do you mean? What overhead can dd have?

----------

## energyman76b

dd is slow, really. If you can choose copying a file with dd, copy or tar - tar and cp are fighting for the lead, dd is strolling some years behind.

try ramspeed.

----------

## Carnildo

 *KarlisRepsons wrote:*   

> As wikipedia say for peak transfer rate:
> 
> DDR2-800 	200 MHz 	5 ns 	400 MHz 	800 Million 	PC2-6400 	6400 MB/s
> 
> mkdir ram0
> ...

 

Seems reasonable.  Keep in mind that, since you're doing a memory-to-memory copy, every byte copied counts twice, and the true speed is 3 GB/s.  The "peak transfer rate" of 6.4 GB/s is something you'll only see in memory benchmarks, where the memory transfers are set up to be as fast as possible.

----------

## energyman76b

keep also in mind that dd fetches every block on its own - so you don't even use any of the advantages of sdram and the latencies become an important factor.

----------

## KarlisRepsons

>keep also in mind that dd fetches every block on its own

If so, everything is about correct. Roughly counting, there are 4 accesses of RAM, not two, so then in total 6GB/s. But that might have its twists and turns.

----------

## energyman76b

just don't trust dd  :Wink:  there are tools to measure ram speed,

----------

## KarlisRepsons

I could be trusting, just if I knew what is the coeff. for dd. Caches are the problem with those tests mainly, for slower devices dd works good as far as I know.

----------

## energyman76b

 *KarlisRepsons wrote:*   

> I could be trusting, just if I knew what is the coeff. for dd. Caches are the problem with those tests mainly, for slower devices dd works good as far as I know.

 

because with slower devices dd waits for the device - and even with harddisks the right block size is very important.

----------

## KarlisRepsons

>even with harddisks the right block size is very important.

It is... But why, if RAM is much faster?

----------

## energyman76b

why the right block size is needed for ram too?

because of the page size and 'bursting' modes. Read up about *sdram in wikipedia  :Wink: 

just try it yourself - dd with a blocksize of 1 and compare that to a bblocksize of 512, 4k and 4M

----------

## KarlisRepsons

Ok, then apparently dd is ok as far as memory latencies can be neglected.

----------

## asturm

AMD Athlon64 X2 5200+, 8192 MB DDR2-800 CL5

cpufreq-set -g ondemand

```
dd if=/mnt/ram0/f of=/mnt/ram1/f bs=512K

700+0 records in

700+0 records out

367001600 bytes (367 MB) copied, 0,742185 s, 494 MB/s
```

cpufreq-set -g performance

```
dd if=/mnt/ram0/f of=/mnt/ram1/f bs=512K

700+0 records in

700+0 records out

367001600 bytes (367 MB) copied, 0,315316 s, 1,2 GB/s
```

----------

## NeddySeagoon

KarlisRepsons,

You are doing reads and writes over the same memory bus to the same physical RAM, so you must double your original result. Also, its all going through the CPU as PCs have no RAM to RAM DMA capability.

A copy to /dev/null may give better results. It might not too, it depends on how /dev/null is implemented.

----------

