Day 313 — Polars, and being specific about where it wins

Tuesday, 15 June 2027 · Week 45 of 52 · Production · Study day · 65 min

The speedups quoted in benchmarks are for operations you may not do, so the useful exercise is measuring your own pipeline rather than reading someone else’s chart.

What you should be able to do tonight

  • Report the speedup on your own three heaviest operations, and identify one where the gain is small.
  • Say what the lazy execution model changes about how you write a query.

Tasks 65 min

30 min Port the three benchmark operations to polars and report the ratio for each. Then find one where the gain is small and explain it: operations dominated by a single column scan or by output serialisation gain little, while group-by and join heavy work gains a lot.

25 min Use the lazy API on the largest one and look at the query plan. The optimiser reorders filters and prunes columns, which means the way you write the query matters less than in pandas, and seeing the plan once is what makes that concrete.

10 min Decide what to migrate: the rule is to port only what the benchmark says is worth porting, and to leave working pandas code alone. Write the decision down so you do not drift into a half-migrated codebase.

Resources

Deliverable

Speedup ratios for three operations with one small-gain case explained, plus a written migration decision.

Checkpoint

Which of your operations gained least from polars, and what property of it explains that?

Prepare for tomorrow

Ten minutes tonight so Day 314, Wednesday, 16 June 2027 starts clean. This is what the evening email sends you.

Find one place in your code where you genuinely need a loop that cannot be vectorised.

A path-dependent calculation such as a drawdown or a stop-loss simulation is the usual case.

Time it and write the number down.