Chapter 1

My Program Is Too Slow

Someone walks into my office and says “My program is too slow.” After a pause, I ask “How slow should it be?”

A good programmer has a ready answer to this question, as she describes the work to be done and estimates of how long each portion should take. Perhaps she says “This database query accesses 10,000 records of which about 1,000 turn out to be relevant; each access should take about 10 milliseconds and they are spread across 20 disks, so 10,000 accesses should be about 5 seconds total. There is no network activity and the CPU processing and memory use are small and simple—all much faster than the disk access time. The actual query is taking about 15 seconds, which is too slow.”

A sloppier programmer might ...

Get Understanding Software Dynamics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.