Timings now and then

19.11.2010 21:22

I've encountered this table of timings for typical operations on a modern PC at a few different places lately. I can't add much to what has already been said about it: without question it is something every programmer should be aware of.

execute typical instruction1 ns
fetch from L1 cache memory 0.5 ns
branch misprediction 5 ns
fetch from L2 cache memory 7 ns
Mutex lock/unlock 25 ns
fetch from main memory 100 ns
send 2 kB over 1 Gbps network 20,000 ns
read 1 MB sequentially from memory 250,000 ns
fetch from new disk location (seek) 8,000,000 ns
read 1 MB sequentially from disk 20,000,000 ns
send packet US to Europe and back150,000,000 ns

For fun and to put these numbers into historical perspective I've put together a roughly equivalent table for Galaksija.

fetch from main memory 1,000 ns
fetch from ROM 1,000 ns
execute typical instruction1,500 ns
branch 4,000 ns
read 1 kB sequentially from memory 8,000,000 ns
read 1 kB sequentially from tape 30,000,000,000 ns
send packet US to Europe and back1,000,000,000,000,000 ns
(depends on postal service)

These numbers also approximately hold for Sinclair Spectrum and other home computers of the era. Note the changes in orders of magnitude in both columns that happened over the last 30 or so years.

Posted by Tomaž | Categories: Code

Add a new comment


(No HTML tags allowed. Separate paragraphs with a blank line.)