std.regexp.split very slow - a bug?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Wed Feb 7 04:55:43 PST 2007


Marc Lohse wrote:
> Becoming curious i rewrote the thing again, now using
> std.string.find:
> 
[snip]
> 
> output:
> marc at marclinux:~/Desktop> time ./find
> seq segment: 197549
> 
> real    0m0.005s
> user    0m0.000s
> sys     0m0.004s
> marc at marclinux:~/Desktop> 
> 
> whoa! Now it only takes 5ms. So my problem seems to be
> solved - i will use either the search or the find variant.

I wanted to post this the first time, but I didn't feel like trying out 
the difference: std.string *also* has a 'split' function. I just tried 
it after reading the first part of your post and it took 4 milliseconds 
on my computer (while the regexp version is still running).

> Interestingly, when splitting the same text at newlines
> the execution just takes about 13ms. I have no idea why
> the split function behaves so differently and this is also
> my question for the experts.

Yes, that's a bit weird.



More information about the Digitalmars-d mailing list