3 ms·
Few people realize this, but completely random RAM access can have lower throughput than e.g. large linear reads from SSD. That’s one of the reasons why I don’t
by throwaway84742 9y ago
Few people realize this, but completely random RAM access can have lower throughput than e.g. large linear reads from SSD. That’s one of the reasons why I don’t trust languages which give me little to no control over data locality.
- banachtarski 9y agoPages from disk are resident in memory when retrieved, so linear reads from ANY disk (not just an SSD), may be faster than random RAM access at some point (the curves will intersect after you pay the initial seek cost). If you're smart about queuing additional page fetches while traversing existing pages, you can accelerate this even more.
- throwaway84742 9y agoNot even when pages are resident in memory. I mean after it gets going, ignoring the initial latency of access, which is indeed staggering by CPU standards. To dramatically slow down memory access it’s enough to just miss the cache every time. Here’s another thing most people don’t know: missing cache results in at least 100-200 cycles of delay to fetch from main RAM. People don’t quite get how long that is. A good demonstration is to count aloud to 200. And then realize that if it was L1 hit, you’d be doing several operations simultaneously per every single count. As CPU frequencies increase, this number trends upward. All of a sudden your ~26GB/s of memory bandwidth turns into a pumpkin.