Video 26 of 53 · 3:25 · Applications, benchmarking and evidence
When preparation is repaid
In this video
Caption transcript
Show transcript
This overview explains how preparation and per-use costs determine a break-even point under a stated reuse model.
A resident artifact can repay setup over many uses, while independently cold requests repeatedly incur that cost.
The candidate spends more on preparation but less on every use.
Let n count comparable uses of the same reusable object.
We assume the object remains valid and that these abstract costs include the
same work on both sides.
For one use, totals are nine and five.
For two, they are ten and eight.
For three, both are eleven.
The preparation penalty is gradually repaid by saving two units per use, but at three uses
the candidate has only reached equality.
A strict win requires eight plus n to be less than two plus three n.
Subtracting gives six less than two n, so n must exceed three.
The first integer count with a strict win is four.
State whether a gate allows equality or requires a strict improvement.
Compare complete cost functions under an explicit reuse model.
A setup cost is paid once only if the artifact really remains valid and resident across those uses.
In a toy example, M costs 8 milliseconds to prepare and 1 per use;
C costs 2 to prepare and 2 per use.
Equality occurs when 8 + q = 2 + 2q, so q = 6.
At 7 uses, M costs 15 and C 16.
If M's per-use cost were 3 instead, its larger setup and steeper slope would never recover.
The retained EPFL calculation includes cases that never break even.
A modeled crossing is conditional on stable costs, valid reuse and the charged lifecycle.
Reload, invalidation, retained memory and extraction can move or remove it.
Do not use a resident model for independently cold requests.
If both methods cost three per use and the candidate begins six units behind, no number of
uses closes that gap under this model.
Reuse alone does not guarantee a crossover; the recurring saving must actually exist.
Return to the first model, but suppose each object becomes invalid after two uses.
Each lifetime ends before the fourth-use win.
The next object starts with a new preparation cost.
Adding uses across incompatible versions would invent reuse that never happened.
A break-even estimate is conditional on its costs and lifetime assumptions.
Real measurements can vary, and output delivery can change the model.
Use the algebra to understand what must be measured, then check that the workload actually
provides the required reuse.
State how long the artifact remains valid and resident.
Include reload, invalidation, extraction, and other required costs before interpreting a modeled crossing.

