TODD is now 16Ahead. This post was written under the old name; the product lives on at 16ahead.com.
Where the time actually goes
Picture a page that loads slowly. Nine times out of ten, it's not because everything on the page is slow — it's because one function runs ten thousand times when it should run once, or a database gets queried inside a loop instead of once before the loop starts. That one spot is the hot path: the small piece of code that runs so often it ends up deciding the speed of everything around it.
Fix that one spot, and the whole system feels faster — even though you didn't touch anything else.
What is a hot path?
A hot path is the section of code that runs most often in a program, such as the inside of a busy loop or a function called on every request. Because it executes so many times, small inefficiencies there add up and set the performance of the whole system.
Not every slow line of code matters. A function that runs once, when the app starts up, is nearly invisible no matter how slow it is. A function that runs on every page view, every search, or every row of a spreadsheet — that's a hot path. It's "hot" because of how often it fires, not because any single run of it looks slow on its own.
Example: a function that looks up a customer by checking every customer in a list takes 2 milliseconds when you have 100 customers. Nobody notices. Run that same function 50,000 times a day once you have 100,000 customers, and it's now the reason the app feels sluggish — even though no single line of code "broke."
How to find it, instead of guessing
Most developers guess wrong about what's slow. Code that feels slow to read and code that actually runs constantly are usually two different things. A profiler settles the argument by measuring instead of guessing. It watches your program run and reports back on three things:
- Time — which functions eat the most total time, not because any one call is slow, but because they run so often.
- Memory — where memory keeps climbing instead of getting released, a sign something is leaking or holding on to data it no longer needs.
- CPU — which operations are actually keeping the processor busy.
You don't need to profile everything. Profile the paths your users actually hit the most — the search bar, the checkout flow, the dashboard that loads on login. That's where hot paths live.
Once you find it, fix it like this
You don't need to rewrite the whole system. You need to fix the one path that's actually hot. Here's what usually works, roughly in the order it tends to matter:
Stop doing the same work twice
The single biggest win is almost always caching: if a function computes the same answer for the same input over and over, save the answer the first time and reuse it. This fixes more hot paths than any clever algorithm trick.
Use the right data structure
Looping through a list to find one item gets slower as the list grows. A lookup table finds the same item in roughly the same amount of time whether you have 100 records or 10 million. That's the difference between "the checkout page got slow once we hit 50,000 customers" and "the checkout page never got slow."
Taliferro hit this exact bug building TODD, our own product. An early version matched incoming signals to a contact by scanning the full contact list — fine with a hundred test records, painfully slow once it was running against real customer data. Swapping that scan for a lookup table took that one operation from the slowest part of TODD to something nobody notices anymore.
Stop waiting on things that could happen at the same time
If your code waits for a database call, then waits for an email to send, then waits for a file to save — one after another — it's spending most of its time waiting, not working. Running independent steps at the same time is often a bigger win than making any single step faster.
Measure again after you fix it
This is the step people skip. Run the profiler again after the change. Sometimes a "fix" just moves the bottleneck somewhere else instead of removing it — you want proof it got faster, not a guess that it probably did.
Hot path vs. cold path
The cold path is everything that runs rarely: startup code, error handling, admin screens, the yearly report. Cold paths should be clear and correct; speed barely matters there. The hot path is the opposite: it is where performance work pays off.
Many teams split the two on purpose. The hot path is kept lean (no logging on every call, no extra database round trips), and anything expensive but rare gets pushed onto the cold path. In data systems you will see the same terms used for real-time processing (hot) versus batch processing (cold).
The takeaway
You don't need to optimize your whole codebase. You need to find the one place that runs the most, fix that one place, and check that it actually got faster. That's the entire practice — everything else is detail.
If you don't know where your hot path is yet, that's usually the real project: not writing faster code, but finding out which code even matters. That's the same diagnostic work Taliferro does on client systems — find the one place that's actually setting the pace, fix that, and let the rest of the system inherit the speed.
Tyrone ShowersStart with system design that removes drag, connect it to the momentum system, or book a short consult.