Microbenchmarking with Google's Benchmark
When the C language was created for PDP-11 minicomputers, performance profiling was easy. Typically there was no memory hierarchy, so accessing memory was a uniform cost regardless of the access pattern. Registers were faster than memory, hence the (now deprecated) register modifier keyword for variables to hint to the compiler that a variable should be kept in a register. The C language mapped itself quite readily to the PDP-11 instruction set, so there weren't often times when you needed to coax the compiler into using a more efficient sequence of assembly instructions and rarely did you need to write assembly language for performance reasons. Those days are long gone, however. Current CPU architectures are full of performance tricks that interact with each other and memory access has a hierarchical cost depending on how far away the memory is from the inner workings of the CPU. Given this complex state of affairs, the chances are that your intuition is wrong when it comes to judging the performance of a chunk of code. So if our intuition is of no use, what do we do? The answer, of course, is to measure the actual performance of code alternatives in order to pick the one that works best for our work loads. This month, Richard Thomson will give us an introduction to "microbenchmarking" using Google's benchmark library. In microbenchmarking, we are measuring the performance of small units of code -- a function, loop, etc. This is similar to a unit test as compared to an integration test. Sample code: https://github.com/LegalizeAdulthood/... Google benchmark docs: https://github.com/google/benchmark/b... Chandler Caruth's CppCon 2015 talk: • CppCon 2015: Chandler Carruth "Tuning C++:... Utah C++ Programmers meetup: https://www.meetup.com/utah-cpp-progr... Past topics: https://utahcpp.wordpress.com/past-me... Future topics: https://utahcpp.wordpress.com/future-... 0:00:00 Introduction 0:03:18 GitHub Repository 0:03:55 Basic Usage 0:12:34 Benchmark Context 0:13:23 Benchmark Report 0:16:37 BENCHMARK Macro 0:17:21 Reported Values 0:18:53 Using VcPkg To Get Benchmark 0:19:44 What Am I Benchmarking? 0:24:35 Benchmark main() 0:26:39 Benchmarking Iterating Orbits 0:28:20 std::complex Implementation 0:30:12 ComplexT Implementation 0:31:31 Primitive Type Implementation 0:34:28 Benchmarking Span of Orbits 0:36:36 SIMD Span Implementation 0:39:00 Results 0:57:24 Memory Subsystem Interactions 0:58:24 Compiler Optimization Interactions 1:04:00 Chandler Caruth's Talk 1:05:00 My Use Case

The Neighbor STOPPED Me WHILE WORKING to WARN ME

Full Archon Guide - Build AI Coding Harnesses That Actually Ship (LIVE)

JIT Code Generation with AsmJit

CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"

How to use Google Benchmark for C++ programs

Keynote: After the AI Hype – What’s Real, and What’s Next - Richard Campbell - 2026

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains

Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

ASMR Best Triggers For Sleep Collection (No Talking) 3 Hours of Tapping & Scratching

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!

The World's Most Important Machine

GOD SAYS;- IT’S TIME I FINALLY TELL YOU THE TRUTH.. | GOD'S MESSAGE FOR YOU TODAY

How to Actually Build Mobile Apps with AI in 2026 | A Complete Beginner's Tutorial

std::simd: How to Express Inherent Parallelism Efficiently Via Data-parallel Types - Matthias Kretz

At Thanksgiving, My Sister Discovered I Had $15 Million And My Family Demanded. | Soft Revenge

COLLAPSE of Personal Computing | Investigation Into the Destruction of Ownership

263 DIOS TE DICE HOY: ESA ANGUSTIA QUE TE ROBA LA PAZ SERÁ CAMBIADA POR DESCANSO

CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!"

