Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization)  @simondev758
Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization)  @simondev758
SimonDev | Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization) @simondev758 | Uploaded 3 years ago | Updated March 14 2024
Why is the first loop 10x faster than the second, despite doing the exact same work?

Follow me on:
Twitter: https://twitter.com/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
Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization) @simondev758Needlessly 3D Chrome Dinosaur Game (JavaScript/Three.js) @simondev758I Tried Making a 3D RPG Game in JavaScript @simondev758Three.js Tutorial on Shaders (beginners) @simondev758How I Optimized My JavaScript Project (Complete Walkthrough) | Faster Spatial Hash Grids @simondev758Spatial Hash Grids & Tales from Game Development @simondev758Three.js  Post Processing Tutorial | Easy & Quick for Beginners (JavaScript) @simondev758Simple Third Person Camera (using Three.js/JavaScript) @simondev758Three.js Cameras Explained | Tutorial for Beginners! (JavaScript) @simondev758Three.js Shadows Explained | Tutorial for Beginners! (JavaScript) @simondev758Three.js Lighting Tutorial (JavaScript) | Light Types Explained! @simondev758Simple Character Controller (using Three.js/JavaScript) @simondev7583D World Generation #8: Floating Origins for Bigger Worlds (JavaScript/Three.js) @simondev7583D World Generation #7: Speeding it up via Threading (JavaScript Web Workers & Three.js) @simondev758I Made a 3D Engine in 1 Day (WebGL/JavaScript) @simondev758Blending (using WebGL/Three.js) - And How to Combine Additive and Alpha Blending @simondev758Writing a Particle System (using Three.js) @simondev758Adding a 3D Model to a Website in 5 minutes (or less) @simondev758When Optimisations Work, But for the Wrong Reasons @simondev758How Games Have Worked for 30 Years to Do Less Work @simondev758How do Major Video Games Render Grass? @simondev758Making an Eyeball with Just a Shader @simondev758Is the COST of JavaScript’s GC REALLY that high? @simondev758So how does your computer ACTUALLY compute sine? Basics of trig and more… @simondev758How Big Budget AAA Games Render Bloom @simondev758How Big Budget AAA Games Render Clouds @simondev758The ONE Texture Every Game NEEDS @simondev758An In-Depth look at Lerp, Smoothstep, and Shaping Functions @simondev758Ray Marching, and making 3D Worlds with Math @simondev758I Tried Making an FPS Game in JavaScript @simondev758SimonDev Course Announcement! | Course Trailer @simondev758Make stuff look better with DECALS! @simondev758Immersive 3D Audio and Visualization (three.js & javascript) @simondev758Building a Simple First Person Camera @simondev758Building a Simple 3D Scene with Physics in JavaScript & Three.js @simondev758What can “The Simpsons” teach us about Dynamic Programming? @simondev758Wait, so comparisons in floating point only just KINDA work? What DOES work? @simondev758Hash Tables, Associative Arrays, and Dictionaries (Data Structures and Optimization) @simondev758Can JavaScript Go Faster? Threading in JavaScript (Data Structures & Optimization) @simondev758Simple Biome Generation (3D World Generation #11) @simondev758I Tried to Make Star Wars Battlefront II in JavaScript @simondev758What Big-O notation ACTUALLY tells you, and how I almost failed my Google Interview @simondev758How Slow is JavaScript Really? JavaScript vs C++ (Data Structures & Optimization) @simondev7583D Mesh Generation, Gaps, and Stitching (3D World Generation #10) @simondev758Why Linked Lists vs Arrays isn’t a real choice @simondev758Logarithmic Depth Buffers and Problems of Scale (3D World Generation #9) @simondev758I made an EVEN BETTER Minecraft @simondev758I Tried Making a 3D MMORPG Game in JavaScript @simondev758Fluffy, Soft Particles (WebGL/Three.js) @simondev758Fog, Basic Fog, and Better Fog (Three.js Tutorial) @simondev758

Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization) @simondev758