The Memory Hierarchy

Joseph Mellor
Jul 29, 2020 · 23 min read

In this article, we’re going to explain how your computer uses memory and how you can work with your computer to write code that runs fast. To be clear, using memory properly will not make poorly written code easy to understand nor will it make a bad algorithm a good algorithm. Understanding how memory works, however, will help you find potential bottlenecks in your program and give you a way to solve them.

I once had to clean up some poorly written code for a job I had. When I say poorly written, I don’t mean something minor like it didn’t use my preferred coding style or even that it was…