The Dark Side of .reserve()
.reserve(...) is a method you might've seen in the API of your favorite dynamic array (or hash table or whatnot), and it's an excellent tool for making simple, impactful performance optimizations while you are building up data structures. But just like all tools, it has sharp edges. In this video we'll dive into where .reserve() can make your performance sing--and where it can be devastating. Special guest appearances from Unreal Engine, spline points, big-O notation, amortized constant complexity, exponential growth, C++ STL algorithms, good Rust design choices, and me forgetting to use the oldSize variable in the call to .resize() on the next line (but it's okay, I use it later on). Starring: std::vector::reserve - https://en.cppreference.com/w/cpp/con... Vec::reserve_exact - https://doc.rust-lang.org/std/vec/str... TArray - https://docs.unrealengine.com/5.2/en-... USplineComponent - https://docs.unrealengine.com/5.2/en-... FBVector (great docs on selecting a good growth factor) - https://github.com/facebook/folly/blo... Contributing to Unreal - https://docs.unrealengine.com/5.2/en-... I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity. https://www.manim.community/ https://www.blender.org/ https://www.audacityteam.org/

Moves Are Broken

Comprehending Proc Macros

Two Ways To Do Dynamic Dispatch

Arc instead of Vec? | Prime Reacts

Cursed C++ Casts

The Cost of Concurrency Coordination with Jon Gjengset

Bun Moved To Rust... Zig's Creator Fired Back

Choose the Right Option

Constructors Are Broken

Rust Functions Are Weird (But Be Glad)

A Simpler Way to See Results

Understanding Rust – Or How to Stop Worrying & Love the Borrow-Checker • Steve Smith • YOW! 2024

Faster than Rust and C++: the PERFECT hash table

From Java to Assembly in Java's 1-Billion-Row Challenge (Ep. 4) | With @caseymuratori

5 Strong Opinions On Everyday Rust

Basics of Odin - A Fast, Simple Programming Language

In 54 Minutes, Understand the whole C and C++ compilation process

C++ Multithreading Explained: Mutexes, Locks, and Queues

How C Really Works

