Measure It
Measure It: Is It Really Slow? Measure Your Own Code, Answer It in One Step: Trading Memory for Time.
Updated
- Is It Really Slow? Measure Your Own Code (Apprentice): Time real code with your language's stopwatch at growing sizes, run it several times and keep the fastest, then read the growth rate from how the times change when the data doubles.
- Answer It in One Step: Trading Memory for Time (Apprentice): Answer "how long are the first few songs?" in one step instead of a loop, by spending a little memory on running totals, and measure both sides of that trade in Big-O: time complexity and space complexity.