language agnostic - What is the cost of memory access? -


We believe memory access is fast and stable, but on modern architecture / OS, it is not necessarily true. / P>

Consider the following C code:

  int i = 34; Int * p = & amp; I; // something that May and P may not include ... {3} later: * p = 643;  

What is the estimated cost of this final assignment in CPU instructions, if

  • i is in L1 cache,
  • i in L2 cache,
  • i is in L3 cache,
  • I is appropriate in RAM,
  • i has been pushed to an SSD disk,
  • to i Has a traditional disc been thrown out?

And where else can i be?

Of course the numbers are not complete, but I'm only interested in the order of magnitude. I tried searching for a web, but Google did not bless me this time.

This exact time is different from the CPU family and version:

These numbers There is a good guide:

  L1 1 NS L2 5 ns ram 83 ns disk 13700000 ns  

And as an infograph, you order magnitude To:

(src)


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -