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/

Two Ways To Do Dynamic Dispatch

Cursed C++ Casts

SIAM A.I. | The Future of Centralized AI Security Managementvideoplayback

Arc instead of Vec? | Prime Reacts

Constructors Are Broken

Rust Functions Are Weird (But Be Glad)

Comprehending Proc Macros

Choose the Right Option

but what is 'a lifetime?

Moves Are Broken

Rust is not a faster horse

Rust's Witchcraft

why rust libraries may never exist.

This Algorithm is 1,606,240% FASTER

Microsoft's Greed is Finally Backfiring

How Does Google Maps Actually Work?

Prime Reacts: The Flaws of Inheritance

*(char*)0 = 0; - What Does the C++ Programmer Intend With This Code? - JF Bastien - C++ on Sea 2023

C++ vs Rust: which is faster?

