Performance Boundaries
Cache Decision
Reuse or Rebuild
A cache boundary chooses between reusing known work and rebuilding fresh output. Modeling the decision keeps the cost tradeoff visible.
Program
Play the script to choose the cache state and see the planned action.
cache_decision_plan.sh
#!/usr/bin/env bash
cache_hit=
if [[ "$cache_hit" -eq 1 ]]; then
action="reuse"
cost=1
else
action="rebuild"
cost=5
fi
echo "$action cost=$cost"
#!/usr/bin/env bash
cache_hit=
if [[ "$cache_hit" -eq 1 ]]; then
action="reuse"
cost=1
else
action="rebuild"
cost=5
fi
echo "$action cost=$cost"
cache hit
A cache hit means previous work can be reused.
cost model
A small cost model makes the tradeoff visible without benchmarking.
rebuild path
The rebuild path is more expensive but refreshes the output.