[dmd-beta] D2 2.058 alpha

Andrei Alexandrescu andrei at erdani.com
Wed Feb 8 13:56:54 PST 2012


+Dmitry

The old regex had a nice optimization for such cases - it cached the 
last engine built.

Dmitry, any idea on how we can approach this?


Andrei

On 2/8/12 1:53 PM, Rainer Schuetze wrote:
> On 08.02.2012 22:14, Jesse Phillips wrote:
>> Ok, it is the new std.regex engine, so it wouldn't be a regression
>> from 2.057.
>>
>> foreach(w; std.string.split(readText(name)))
>> if(!match(w, regex(r"\d")).empty)
>> {}
>
> I have not tried, but I guess the trouble comes from rebuilding the
> regex engine for every word. Did you try
>
> auto re = regex(r"\d");
> foreach(w; std.string.split(readText(name)))
> if(!match(w, re).empty)
> {}
>
>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta


More information about the dmd-beta mailing list