Big O in practice
Linear search, binary search and a check of every pair, timed at growing sizes: watch time grow like n, like log n and like n squared, and predict the next one.
Open it in the simulatorProfile real code on an ESP32-C3 with micros() and the cycle counter, then make it fast: Big O, floats, the heap, tables and caches, ending in a starfield fifty times faster.
0 of 7 done
7 lessons in 4 chapters, about 6 hours on a simulated ESP32-C3-DevKitM-1. Free, in your browser, every step checked by the simulator.
Linear search, binary search and a check of every pair, timed at growing sizes: watch time grow like n, like log n and like n squared, and predict the next one.
Open it in the simulatorWhere globals, the heap and the stack live in the C3's 400 KB, what malloc really costs, why two growing Strings fight over the heap, and how reserve() ends the fight.
Open it in the simulatorRemember answers instead of working them out again: a memo table takes Fibonacci from 150,049 calls to 47, and a HUD that remembers what it drew stops redrawing every frame.
Open it in the simulatorEach lesson opens when the one before it is done, and each chapter ends in a project.
Find where the time goes before changing a line, and how it grows when the data does.
One frame of a space game is four jobs. Guess the slow one, then time each with micros(), learn what a measurement can and cannot see, and time a job yourself.
0 of 5 steps
Linear search, binary search and a check of every pair, timed at growing sizes: watch time grow like n, like log n and like n squared, and predict the next one.
0 of 5 steps
What an instruction, a float and an allocation really cost on a 160 MHz RISC-V core.
Read the core's own cycle counter, see what an add, a multiply and a divide cost, find out why float math is slow on a chip with no FPU, and dim 1,000 pixels on a budget.
0 of 5 steps
Where globals, the heap and the stack live in the C3's 400 KB, what malloc really costs, why two growing Strings fight over the heap, and how reserve() ends the fight.
0 of 5 steps
Work things out once and remember them: lookup tables and caches.
A sine wave across the panel two ways: sinf() for every column, or a table worked out once. Time both, measure the table's error in pixels, and pick its size.
0 of 5 steps
Remember answers instead of working them out again: a memo table takes Fibonacci from 150,049 calls to 47, and a HUD that remembers what it drew stops redrawing every frame.
0 of 5 steps
Profile a slow starfield and make it fifty times faster.
A warp-speed starfield runs at 9 frames a second. Profile it, find the job eating the frame, fix it, and push it past double, then past 300 frames a second.
0 of 5 steps
All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.
Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.
Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kitYes. All 7 lessons of Fast code: measure, then optimize are free and run in your browser, with nothing to install and no parts to buy before you start.
No. Every lesson runs on a simulated ESP32-C3-DevKitM-1 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.
About 6 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.
Each chapter ends in a project that puts it together: Big O in practice, Memory and allocation and Caching.
With "Measure first", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.