What Every Programmer Should Know about How CPUs Work • Matt Godbolt • GOTO 2024
GOTO Conferences
@goto-About
GOTO gathers the brightest minds in the software community to help developers tackle projects today, plan for tomorrow and create a better future. Learn from thought leaders and innovators with top-rated videos released daily, and at our year-round conferences, masterclasses and meetups. GOTO offers attractive sponsorship opportunities for partner companies. Reach out for limited offerings: [email protected] GOTO YouTube Channel Code of Conduct: https://blog.gotocon.com/yt-coc
Video Description
This presentation was recorded at GOTO Chicago 2024. #GOTOcon #GOTOchgo https://gotochgo.com Matt Godbolt - Low-level Latency Geek @MattGodbolt RESOURCES https://bsky.app/profile/matt.godbolt.org https://xania.org https://github.com/mattgodbolt https://www.linkedin.com/in/godbolt https://twitter.com/mattgodbolt https://godbolt.org ABSTRACT When programming these days it’s easy to forget the many layers of abstractions between what you type and what the computer you run your code on is actually doing. In this talk, Matt will describe some of the performance features of modern CPUs and explain how your code is already benefiting from them. We’ll look at real-world server performance, the tooling available to measure their impact, and how compilers are often already doing the right thing for us. By the end of the talk you’ll appreciate the amazing work of chip designers and compiler authors, but you’ll also know how to diagnose when things go awry, and what to do about it. [...] TIMECODES 00:00 Intro 00:25 What to get out of this talk 01:13 A modern CPU pipeline 11:47 Branch prediction 21:27 Demo 26:15 Execution 28:56 Demo 34:53 Can the compiler save us? 35:08 Demo 36:46 Memory 37:52 Results 40:11 Top-down analysis 41:12 Perf 42:06 Conclusion 43:11 Outro Download slides and read the full abstract here: https://gotochgo.com/2024/sessions/3281 RECOMMENDED BOOKS Bjarne Stroustrup • Programming: Principles and Practice Using C++ • https://amzn.to/3Tya5G6 Bjarne Stroustrup • Tour of C++ • https://amzn.to/47w28Hd Bjarne Stroustrup • The C++ Programming Language • https://amzn.to/4ebJwyU John Horton • Beginning C++ Game Programming • https://amzn.to/3B8fvBd https://bsky.app/profile/gotocon.com https://twitter.com/GOTOcon https://www.linkedin.com/company/goto- https://www.instagram.com/goto_con https://www.facebook.com/GOTOConferences #CPU #CPUPipeline #HowCPUsWork #ChipDesign #x86 #x86ASM #Compiler #BranchPrediction #BloomFilter #SMT #CacheCoherency #Cache #SIMD #kcachegrind #uICA #MattGodbolt CHANNEL MEMBERSHIP BONUS Join this channel to get early access to videos & other perks: https://www.youtube.com/channel/UCs_tLP3AiwYKwdUHpltJPuA/join Looking for a unique learning experience? Attend the next GOTO conference near you! Get your ticket at https://gotopia.tech Sign up for updates and specials at https://gotopia.tech/newsletter SUBSCRIBE TO OUR CHANNEL - new videos posted almost daily. https://www.youtube.com/user/GotoConferences/?sub_confirmation=1
Boost Your Coding With These CPU Must-Haves
AI-recommended products based on this video

Intel Core i9-12900KF Desktop Processor 16 (8P+8E) Cores up to 5.2 GHz Unlocked LGA1700 600 Series Chipset 125W

ASUS ROG Strix G16 Gaming Laptop, GeForce RTX 5070 Ti 12GB GDDR7, AMD Ryzen 9 8940HX, 64GB DDR5, 2TB SSD, Backlit Keyboard, Wi-Fi 6E, 16" WUXGA 165Hz Display, Win 11, Gray, 1TB Docking Station Set

Lenovo Legion Pro 5 16" WQXGA 165Hz Gaming Laptop, AMD Ryzen 9 9955HX, GeForce RTX 5070, 32GB DDR5, 3TB Storage (2TB SSD+1TB Docking Station Set), 24-Zone RGB Backlit Keyboard, WiFi 7, Win 11, Black

GEEKOM A7 Max Mini PC (Flagship Level Performance), AMD Ryzen 9 7940HS (Up to 5.2GHz),Mini Computer 16GB DDR5 RAM and 1TB PCIe 4.0 SSD, Windows 11 Pro, Quad 8K Display, USB4, Dual 2.5G LAN, Wi-Fi 6E

GEEKOM A8 AI Mini PC (3-Year Quality Support) with AMD Ryzen 9 8945HS Mini Computers, 32GB DDR5 RAM&2TB M.2 2280 NVMe Gen4*4 SSD, Windows 11 Pro Mini Desktop, WiFi 6E/BT5.2/USB4/8K/Quad Display

CORSAIR iCUE Link XD5 RGB Elite LCD Pump-Reservoir Unit - D5 PWM Pump - 480x480 IPS LCD Screen - 22 Addressable RGB LEDs - 440ml Nylon Reservoir - White

CORSAIR iCUE Link XC7 RGB Elite CPU Water Block - Transparent Flow Chamber - 24 RGB LEDs - Fits Intel® LGA 1700, AMD® AM5 and Older - White

CORSAIR Hydro X Series iCUE Link XH405i Custom Cooling Kit – Hardline Water Cooling Loop – XC7 Elite CPU Water Block – XD5 Elite D5 Pump Res – XR5 360mm Radiator – 3X QX120 RGB Fans

Portable Air Conditioners, wobuzhi Evaporative Air Cooler with LCD Screen, Fan Speed&Spray, 7 RGB Lights,USB Powered,1-8H Timer, Personal Air Conditioners, Portable Air Conditioners for Home Office

llano RGB Laptop Cooling Pad with Powerful Turbofan Gaming Cooler Radiator with Infinitely Variable Speed, Touch Control, LCD Screen, 3-Port USB Hub, Seal Foam for Notebook Computer 15-19in

Neck Fan with Cooling Plate,Portable Neck Fan Rechargeable Battery Powered,Bladeless Personal Air Conditioner Wearable Neck Cooler Fans,USB Electric Quiet Necklace AC Fans for Travel Outdoor Black

MSI MAG CORELIQUID A15 240 - AIO ARGB CPU Liquid Cooler - 240mm Radiator - AM5, LGA 1851 Ready - Dual 120mm ARGB PWM Fans, Black

Crucial 64GB DDR5 RAM, 5600MHz (or 5200MHz or 4800MHz) Desktop Memory Kit, UDIMM 288-Pin, Compatible with 13th Gen Intel Core and AMD Ryzen 7000 - CT2K32G56C46U5

Samsung 990 EVO Plus - 4TB PCIe Gen4. X4, Gen5. X2 NVMe 2.0 - M.2 Internal SSD, Speed Up to 7,250 MBs, Upgrade Storage for PC-Laptops, HMB Technology and Intelligent Turbowrite (MZ-V9S4T0B/AM)
![SAMSUNG 990 PRO SSD 4TB PCIe Gen4 NVMe M.2 Internal Solid State Hard Drive, Up to 7,450MB/s, Heat Control, Direct Storage and Memory Expansion, MZ-V9P4T0B/AM [Canada Version]](https://m.media-amazon.com/images/I/81WuG6lQuDL._AC_UL960_FMwebp_QL65_.jpg)
SAMSUNG 990 PRO SSD 4TB PCIe Gen4 NVMe M.2 Internal Solid State Hard Drive, Up to 7,450MB/s, Heat Control, Direct Storage and Memory Expansion, MZ-V9P4T0B/AM [Canada Version]
![Samsung 9100 PRO Series - 4TB PCIe 5.0 x4, NVMe 2.0, M.2 Internal SSD, Up to 14,800MB/s, Fast Speed, Thermal Contorl, MZ-VAP4T0B/AM [Canada Version]](https://m.media-amazon.com/images/I/71qygJIcKnL._AC_UL960_FMwebp_QL65_.jpg)
Samsung 9100 PRO Series - 4TB PCIe 5.0 x4, NVMe 2.0, M.2 Internal SSD, Up to 14,800MB/s, Fast Speed, Thermal Contorl, MZ-VAP4T0B/AM [Canada Version]
![SAMSUNG 870 EVO SATA SSD 500GB 2.5” Internal Solid State Drive, Upgrade PC or Laptop Memory and Storage for IT Pros, Creators, Everyday Users, MZ-77E500B/AM [Canada Version]](https://m.media-amazon.com/images/I/911ujeCkGfL._AC_UL960_FMwebp_QL65_.jpg)
SAMSUNG 870 EVO SATA SSD 500GB 2.5” Internal Solid State Drive, Upgrade PC or Laptop Memory and Storage for IT Pros, Creators, Everyday Users, MZ-77E500B/AM [Canada Version]

LG UltraWide 34WP65C-B 34 Inch 21:9 Curved FreeSync 1ms 160 Hz WQHD(3440 x 1440) Gaming Monitor, Black

Lg gram 16-inch +View Portable Monitor with USB Type-C, DCI-P3 99% (Typ.), Auto Rotate, Two-Way Supported Folio Cover

StanbyME LG 27-Inch Class Smart Portable Touch Screen Monitor 27ART10AKPL. Built-in 3 Hour Battery, Full Swivel Rotation, Rollable. LG Stanbyme, Standbyme, Stand by me.

LG 24U411A-B 23.8" FHD (1920x1080) IPS Display Computer Monitor, 120Hz Refresh Rate, sRGB 99% (Typ.), USB-C, Reader Mode & Flicker Safe, Dynamic Action Sync, Black Stabilizer, Slim Stand Base, Black

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

Logitech K250 Bluetooth Keyboard with Numpad, Easy Connectivity, Compact Wireless Keyboard Made with Recycled Plastic, Spill-Resistant, Comfortable Keys - Windows/MacOS - Graphite

Logitech G305 Lightspeed Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

Logitech K400 Plus Wireless Touch TV Keyboard With Easy Media Control and Built-in Touchpad, HTPC Keyboard for PC-connected TV, Windows, Android, Chrome OS, Laptop, Tablet - Black

Razer BlackShark V2 X Gaming Headset: 50mm Drivers - Cardioid Mic - Memory Foam Cushion - Lightweight- Comfortable, Noise Isolating Earcups - for PC, PS4, PS5, Switch - 3.5mm Audio Jack - Black ECOLOGO

230W Charger Compatible with Razer Blade 14” 15” 16" 17” (2025-2018) RZ09 RTX-3060/3070/3080/4060/4070 Gaming Laptop RC30-0530 RC30-0238 RC30-0248 Replacement Power Adapter

Monster N-Lite 211 Wireless Earbuds, Bluetooth 6.0 Stereo Headphones with Noise-Cancelling Mic and LED Display, Built-in Mic for Clear Calls, Waterproof Design for Sports

Monster N-Lite 211 Wireless Earbuds, Bluetooth 6.0 Stereo Headphones with Powerful Bass, Built-in Noise-Cancelling Mic for Clear Calls, LED Display, 36H Playtime, IPX5 Waterproof Design for Sports

CORSAIR Hydro X Series iCUE Link XH405i Custom Cooling Kit – Hardline Water Cooling Loop – XC7 Elite CPU Water Block – XD5 Elite D5 Pump Res – XR5 360mm Radiator – 3X QX120 RGB Fans



















