How much slower is random access, really?
You may know that, because your computer has different caches (L1, L2,
L3...), and memory operations operate on cache lines of about 64 bytes
each, you should write programs that exhibit
locality
to get maximum performance.
L1
L1
L1
L1
L1
L1
L2
L2
L2
L2
L2
L2
L3
RAM
(Disk not shown, of course.)
But how well do you understand this idea? For
instance, let's say you have an array of floating-point numbers, and
an array of all the indices of the first array. You have a program
that adds up the numbe...
Read more at samestep.com