Nothing Special   »   [go: up one dir, main page]

How Does CPU Cache Work and What Are L1, L2, and L3 Cache? [+ Performance Impact]

CG Director Author Christopher Harperby Christopher Harper   /  Published 

How does CPU Cache work and what are L1, L2, and L3 Cache? Do these questions actually matter that much for you, the end user? What performance impact do these specifications have on your performance?

I’ll be tackling these questions and more throughout this article, in hopes of demystifying the concept of CPU Cache for present and future readers.

Let’s get into it!

What is CPU Cache?

CPU cache refers to memory that is built directly onto your CPU. It is distinct from system memory (RAM), which is mounted to the motherboard and actually far slower than the CPU cache.

Let’s break down some of those differences.

How CPU Cache Differs From Other System Memory (RAM, VRAM, ETC)

So, if your PC’s RAM is your system memory, why does your CPU need its own dedicated on-chip cache?

After all, RAM only gets faster every year, with DDR4 and DDR5 RAM alike both pushing the limits of DRAM Frequency.

The answer is surprisingly simple: System Memory still isn’t fast enough, and even though it’s mounted closer to the CPU than any of your other components, that distance still matters, electrically speaking.

CPU cache is necessary because by the time your storage and RAM have sorted out what you’re doing, your CPU still needs to be able to break down what it’s doing in real-time into binary machine language.

That requires some cutting-edge speed on your CPU’s part, even if CPU cache is generally measured in dozens of Megabytes instead of a dozen or more Gigabytes like system RAM is.

How Does CPU Cache Work?

So, the purpose of CPU cache is to break down everything happening on your PC into simple 1s and 0s that your CPU is actually made to handle.

By comparison, your dedicated system RAM can hold pretty much any kind of data, from apps in use to video files and such whenever you’re doing video rendering.

computer memory Heirarchycomputer memory Heirarchy

CPU cache is about managing the actual real-time instructions that are being fed to your CPU, and a larger CPU cache size reduces the need for system memory to be accessed as frequently by the CPU, giving you more performance in CPU cache-sensitive workloads.

More on those in a bit!

What Are L1, L2, and L3 Cache?

L1 Cache

L1 Cache, or Level 1 Cache, is the primary CPU cache. It’s the fastest “level” of CPU cache and also has the smallest memory capacity. The faster/lower-level your Cache, the less CPU cycles it takes for your CPU to access it.

To the outside user these “cycles” correspond to individual Hertz on processors boasting the ability to handle multiple Gigahertz of cycles per second— meaning a modern CPU processes billions of cycles per second.

So realistically, the difference we’re talking about here between L1 and L2 cache is only noticeable on the machine side of things. That difference still matters, though, so let’s talk about L2 cache!

L2 Cache

L2 Cache, or Level 2 Cache, is the secondary CPU cache. It’s slower than Level 1 Cache, but still pretty fast, and offers a significant bump in memory capacity.

Depending on if your CPU has an L3 Cache or not, L2 Cache will either be distributed across individual CPU cores or shared by all CPU cores. Until very recently, Intel CPUs only used L2 Cache while AMD adopted L3 Cache years ago.

These days, Intel uses L3 Cache as well, though it’s distributed differently depending on whether the CPU core is a P-Core or E-Core.

CPU Architecture CacheCPU Architecture Cache

L3 Cache

Finally, let’s talk L3 Cache, also known as Level 3 Cache.

L3 Cache is slower than Level 1 and 2 Cache but serves the purpose of making them both faster by providing the largest pool of on-CPU memory for them to utilize.

L3 Cache is also shared by every CPU core, whereas L1 and L2 Cache are usually built into individual cores.

How CPU Cache Impacts Performance

Now that we’ve gone over the basics of what CPU Cache is, let’s talk about how it can impact your performance.

I think the best case study for the sake of this article will actually be the AMD Ryzen 5800X, and its 5800X3D variant.

AMD 5800x3d V-CacheAMD 5800x3d V-Cache

Image Credit: AMD

These are more or less the same CPU in terms of CPU core architecture and core count, but the 3D variant actually boasts a much larger L3 Cache (a whopping 96MB on the 3D compared to the 32MB on the standard 5800X).

This makes it much easier to quantify how boosting CPU cache impacts performance since generally CPU cache is gradually increased alongside other CPU specifications as you climb the product stack anyways.

Technically the CPU did require some changes in order to make the increased L3 Cache possible. The Base and Boost Block on the 3D are both reduced to 3.4 GHz and 4.5 GHz, respectively, compared to the 3.8-4.7 GHz spec of the original 5800X.

Additionally, the 3D does not support overclocking at all. These are fairly minor downward bumps to clock speed, but still worth noting.

So, what does boosting CPU cache without majorly changing the rest of the CPU do to performance? Let’s take a closer look.

AMD Ryzen 7 5800X3D Content Creation PerformanceAMD Ryzen 7 5800X3D Content Creation Performance

Source: PugetSystems

In terms of content creation, boosting the L3 Cache either doesn’t provide a meaningful performance boost in most workloads (as the Cache wasn’t the bottleneck to begin with) or actively reduces performance due to other sacrifices that had to be made for the increased L3 Cache, e.g. lower clock-speeds.

For gaming, though, it turns out boosting L3 Cache is quite beneficial.

AMD Ryzen 7 5800X3D vs. AMD Ryzen 7 5800XAMD Ryzen 7 5800X3D vs. AMD Ryzen 7 5800X

Source: TechSpot

According to TechSpot’s 41-game benchmark run of the 5800X3D, that boost to L3 Cache is quite significant for gaming performance so long as the game is properly optimized.

Even the most intensive game on that list, Microsoft Flight Simulator, sees a whopping 21% average performance boost.

Those particularly well-versed in gaming benchmarks should also know the importance of boosting 1% lows, as those indicate when the game engine is struggling most to render everything onscreen.

The increased L3 Cache also helps massively in these scenarios, as highlighted below:

AMD Ryzen 7 5800X3D vs. AMD Ryzen 7 5800X [1% Lows]AMD Ryzen 7 5800X3D vs. AMD Ryzen 7 5800X [1% Lows]

Source: TechSpot

So, what’s the takeaway here?

Obviously, you can’t really boost your CPU cache without changing the entire CPU.

For the buyer, it’s much wiser to look at benchmarks for your workloads when evaluating which CPU best suits your needs, not which one just happens to have more or less CPU cache.

That said, the 5800X and 5800X3D provided us with an unprecedented look at how the overlooked CPU cache specification actually can impact CPU performance.

Turns out it’s really good for gaming and select productivity workloads, like H.264 encoding. But overall, CPU cache alone shouldn’t be your main focus when buying a CPU, even if more CPU cache is better for gaming performance.

FAQ

Does L4 Cache Exist?

If you were paying close attention throughout this article, you may realize that L1 and L2 Cache have been the standard for a long time, with L3 Cache being mostly-exclusive to AMD CPUs until more recent Intel CPU generations.

Without the presence of L3 Cache, L2 Cache pretty much serves the same role on older CPUs.

So, all L4 Cache really is is yet another level of higher-capacity, lower-speed, on-die CPU memory. It’s pretty rare and not at all common in desktop CPUs, but it does, in fact, exist, especially if the desktop CPU in question has Integrated Graphics.

It may even end up becoming more commonplace as time goes on since Intel announced that their 14th Gen CPUs will be using L4 Cache.

Are L2 Cache and L3 Cache Always on The CPU?

L3 Cache, yes.

L2 Cache, almost always yes. However, in the past, L2 Cache has also been found on a coprocessor in immediate proximity to the CPU.

These days, all “L-Caches” are on the CPU itself, with RAM and GPU VRAM being the only sources of memory available to the rest of the system and the CPU after using its own Cache.

Over to You

And that’s it, for this article!

The truth is, I needed to cut quite a bit of the information researched for this article in the interest of keeping things concise and accessible to the wider audience of CGDirector.

The deeper intricacies of CPU caching and CPU instructions are a little…outside the scope of these articles, especially if you aren’t already a programmer or an engineer. However, the information here should hopefully help clear up how CPU cache impacts your performance!

Any other questions about CPUs, CPU cache, or PC hardware? Feel free to ask them in the comments section below! Me or one of my fellow CGDirector Team members will be happy to help. With any other tech topics, or personal build/render projects, also consider checking out the CGDirector Forums!

Until then, or until next time, stay safe and happy computing!

CGDirector is Reader-supported. When you buy through our links, we may earn an affiliate commission.

Christopher Harper

I have been a passionate devotee to technology since the age of 3, and to writing since before I even finished high school.

These passions have since combined into a living in my adulthood and have made writing about PC Hardware very satisfying.

If you need any assistance, leave a comment below: it’s what I’m here for.

0 Comments

Also check out our Forum for feedback from our Expert Community.

Leave a Reply