[Chicago-talk] Using a hash in a regex

Kent Cowgill kent at c2group.net
Thu Jul 13 15:53:09 PDT 2006


On Thu, 13 Jul 2006, Andy Lester wrote:
> > You could benchmark the two approaches.
>
> But please don't.  Your program is certainly not going to be
> constrained by the speed of some regex matching.  Your programmer
> time is far more valuable than a second or two of computer time.

Very good point.  Note I didn't say "should" :)

If this is a one-off, or a nightly thing where speed doesn't matter, and
the file listing is sufficiently small (<1000?), and you're comfortable
with one solution as opposed to the other, I'd say take your pick, and
Andy's point is more than valid.

I can't imagine how the above situation wouldn't be the case, but if you
really have to squeeze every last bit of performance out of this mission
critical file-renaming function, OR if you're just naturally inquisitive
and really need to know the answer, then benchmarking would be a proper
course of action.

-Kent


More information about the Chicago-talk mailing list