Pages

Monday, March 11, 2013

Numbers I Should Keep In Mind

Name Nanoseconds
L1 cache reference 0.5
Branch mispredict 5.0
L2 cache reference 7.0
Mutex lock/unlock 100.0
Main memory reference 100.0
Compress 1K bytes with Zippy 10,000.0
Send 2K bytes over 1 Gbps network 20,000.0
Read 1 MB sequentially from memory 250,000.0
Round trip within same datacenter 500,000.0
Rusty disk seek 10,000,000.0
Read 1 MB sequentially from network 10,000,000.0
Read 1 MB sequentially from disk 30,000,000.0
Send packet from CA->Netherlands->CA 150,000,000.0

From always excellent kellabyte.

6 comments:

  1. Great numbers.

    But will depend highly about the hardware it runs on. For instance, Mutex lock/unlock will depend on what multi-thread is implemented, how many cores are sharing some data in their cache, and so on...

    But as order of magnitudes, it is a pretty good approach.

    ReplyDelete
    Replies
    1. Yes, I'm pretty sure that mutex lock/unlock is much more expensive on a Wintel platform.

      Delete
    2. Those mutex costs could match a critical section in Windows in low contention scenarios. Maybe that's what was meant rather than a Windows mutex object?

      Delete
  2. Anonymous16:57

    The only number you should keep in mind is 42.

    ReplyDelete
    Replies
    1. Especially today :)

      Delete
    2. but what was the question?
      :)

      Delete