Re: [PATCH 13/16] send-email: extract_valid_address use qr// regexes and /o
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 30, 2010, 17:25 UTC
- Message-ID
- <7vocbfjg7x.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20100930161912.GA8707@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> ... > But we are unnecessarily compiling the sub-regexes each time. Not that > this is probably a performance critical piece of code, but your "/o" is > doing very little, and this is exactly the sort perl wankery that I find > interesting.
Well, isn't the _sole_ point of using qr// to optimize by avoiding recompilation? If this is not a performance critical section of the code, what is the point of this change?
This [PATCH 13/16] and also [PATCH 12/16] rewrite strings using qr// but the patterns thus compiled are used exactly once before the control leaves the scope of the variables, so...
It is a different story if the patch instead introduced module-level global variables to hold a pre-compiled regexp objects, but that is not what we are seeing here.