doubling the number of tests, but not taking twice as long

Larry Martell larry.martell at
Mon Jul 16 18:22:01 EDT 2018

On Mon, Jul 16, 2018 at 6:01 PM, Gilmeh Serda
<gilmeh.serdah at> wrote:
> On Mon, 16 Jul 2018 14:17:57 -0400, Larry Martell wrote:
>> This code needs to process many tens of 1000's of files, and it runs
>> often, so it needs to run very fast. Needless to say, my change has made
>> it take 2x as long. Can anyone see a way to improve that?
> Don't use RegEx search?
> My version 361, and a simple benchmarking thing, tells me it's about 2.7
> times slower than "if ... in ..." on 1,000,000 loops.

Without the regex how would you suggest I search for '_M\d+_' efficiently?

More information about the Python-list mailing list