On 8/4/05, Robert Klemme <bob.news / gmx.net> wrote:
> Garance A Drosehn <drosihn / gmail.com> wrote:
> > Almost.  I was saying that I *wanted* to have them distant,
> > because the result is more readable (for what I'm doing, IMO),
> > and for the efficiency benefit.
> 
> As I said there is no such thing as an efficiency benefit in using
> "remote" regexps.

Ah, okay.  I guess I was reading too much into the word "compiled",
such that I thought it would be significantly faster.

> >  This may seem weird, but most
> > of the regexp's that I'm talking about are three or four full lines
> > long, complete with a few regexp tricks that take a few more
> > lines of comments to explain what the regexp is doing.  The
> > case-statement is *much* more readable if the regexp's are
> > separated from the case statement.
> 
> I'd stick with the readability argument and forget about the performance
> here.  The question is, does the code become more readable by moving
> the regexps out of the case statement?  I don't know your code but I'd
> say it's not automatically so.

In the script that I am working on right now, it is definitely more
readable.  But in most scripts I write, the readability is probably
about the same either way.  It wouldn't surprise me if readability
was usually better with regexp's in the case statement that uses
them, especially if they are all single-line regexp's.

I first wrote this script with the regexp's in place, and that was
getting too messy (IMO).  So I've now redone them with the
regexp's separate.  I might do some performance comparision
of the two versions once I'm done.  But I doubt that will be very
accurate, because I am changing so many other things at the
same time. 

-- 
Garance Alistair Drosehn     =             drosihn / gmail.com
Senior Systems Programmer               or   gad / FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA