Day 312 — Profile first, because your guess was wrong

Monday, 14 June 2027 · Week 45 of 52 · Production · Study day · 60 min

The gap between where you thought the time went and where it went is the reason optimisation without measurement is a hobby rather than an engineering practice.

What you should be able to do tonight

  • Profile a real pipeline and identify the actual bottleneck, with numbers.
  • State the rule you will follow before any optimisation, and record a baseline you can compare against.

Tasks 60 min

30 min Analyse last night’s profile properly: total time, the top functions by cumulative and by self time, and the fraction spent in your code against in libraries. Then run a line profiler on the single worst function. The bottleneck is usually a data conversion or a loop over a dataframe rather than the computation you were worried about.

30 min Establish a baseline harness: a script that runs your three heaviest operations and reports their timings, committed and re-runnable. Every optimisation for the rest of the phase is measured against it, and a change that does not move it does not go in.

Resources

Deliverable

A profile of your slowest step with the real bottleneck identified, plus a committed benchmark harness with baseline timings.

Checkpoint

Where did you think your pipeline’s time was going, and where was it actually going?

Prepare for tomorrow

Ten minutes tonight so Day 313, Tuesday, 15 June 2027 starts clean. This is what the evening email sends you.

Rewrite one dataframe operation from your bottleneck in polars and time it against the pandas version.

Use the same input and check the outputs match exactly.

Two numbers and one equality check.