Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization)
SimonDev
0:00 / 0:00
Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization)
341 278 просмотров · 5 л. назад
SimonDev
237 тыс. подписчиков
341 278 просмотров · 5 л. назад
Why is the first loop 10x faster than the second, despite doing the exact same work?
Follow me on:
Twitter: / iced_coffee_dev
Github: https://github.com/simondevyoutube/
In this video we talk a bit about memory, the cpu caches (specifically the L1/L2/L3 cache), hardware prefetching, and how all this comes together for arrays. We'll be covering each of these topics in enough detail for you to get a solid understanding, working through real world examples to help illustrate the point. We'll talk about the most fundamental data structure, arrays, how they work, what situations they're great in, and when they suck. We'll also touch on some algorithmic complexity. Finally, we'll be talking about why understanding this is important and how this leads in to more advanced topics and data structures.
What's covered:
How memory allocation works, memory addresses
Contiguous memory
CPU Caches, L1/L2/L3 cache
Hardware prefetching
Array operations, what's fast and what isn't
Closing thoughts, why this is important to understand, how this relates to more advanced data structures