Generator

Choosing a growth factor is choosing where to lose

Rendered here at the parameters it defaults to, with every essay that calls it — which is the same list as the blast radius of changing it.
Choosing a growth factor is choosing where to loseEach point is a growth factor, appending 20,000 elements. Rightwards is more memory left unused when the sequence ends; upwards is more copying per append. Growing by ×1.125 wastes almost nothing and costs 9.89 units per append; growing by ×4 costs 2.09 and leaves 69% of the allocation empty. No point is below and left of every other, which is the definition of a trade-off and the reason real implementations disagree about this number.0%25%50%75%12345×1.125×1.25×1.5×2×3×4capacity left unused at the endamortised cost per append20,000 appends, cost = 1 write + a copy on resizeneither end wins

Choosing a growth factor is choosing where to lose

Each point is a growth factor, appending 20,000 elements. Rightwards is more memory left unused when the sequence ends; upwards is more copying per append. Growing by ×1.125 wastes almost nothing and costs 9.89 units per append; growing by ×4 costs 2.09 and leaves 69% of the allocation empty. No point is below and left of every other, which is the definition of a trade-off and the reason real implementations disagree about this number.

Drawn at 670 × 380, wide on the page. Everything above is what growth-tradeoff returns with no arguments; the caption is the generator's own, computed from the numbers in the drawing rather than written beside it.

2 essays call growth-tradeoff. The drawing above is what it returns with no arguments at all; every call below passes it something, because a placement that passes nothing draws whichever member of the family the generator happens to default to rather than the one its essay argues about — which is what optcheck and figfill exist to catch.

Where it is called

Changing this generator changes every one of these figures.

The library, page 2 of 5 — where growth-tradeoff sits