
89Standard Performance-Tuning Techniques
15:30:05'). The problem is that we may need to call datestr repeatedly, for multiple
numeric dates, for example, in a callback that recomputes axis tick labels upon pan/zoom.
Unfortunately, the datestr implementation is not vectorized, so computing datestr for a
vector of 1000 dates takes almost 1000 as much time to calculate as a single date. Doing so
repeatedly can be disastrous for performance.
If we are certain of the precondition that the output string format is the same, we can
cache the results, and even use vectorization to further speed up processing. In my specic
case,
181
I plotted historical ...