From the course: Go Performance Optimization
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Computer architecture overview - Go Tutorial
From the course: Go Performance Optimization
Computer architecture overview
- [Instructor] Let's take a look at how computers are built and how much time various operations take. So modern computers have several cores. Each core has its own cache, which it stores its own local data. Close to it we usually have an L1 and L2 cache and shared L3 cache, and finally, the memory, the built-in memory of the computer. These caches are fast but the L1 cache takes about four cycles to get data from while the L2 is about 12 cycles and the L3 about 36 cycles. I love this diagram from Josh Jordan. Let's assume that the CPU cycle takes 0.4 nanoseconds. This is about 2.7 gigahertz CPU and we are going to call it a second. When we reach out to the L1 cache, this is going to take 0.9 nanoseconds, about twice the time, so we call it two seconds. If you miss the caches, and we are going to the memory, this is about 100 nanoseconds, but if we convert it to our own human scale, this is about four minutes, meaning…