On Sat, 02 Mar 2013 12:20:22 -0500, Andrei Alexandrescu <[email protected]> wrote:

On 3/1/13 6:26 PM, Steven Schveighoffer wrote:
On Fri, 01 Mar 2013 18:22:54 -0500, Steven Schveighoffer
<[email protected]> wrote:

So it's just pure heuristics. Not hard to see how that would affect a
10 million cycle program.

We may be able to create a string-specific version of splitter that
would take advantage of the representation.

Just found a disturbing artifact: splitter(message, '\n') is more than
twice as slow as splitter(message, "\n")

-Steve

That is a problem. Could you please file a but report?

http://d.puremagic.com/issues/show_bug.cgi?id=9645

In trying to make a minimal test case, I found that the algorithm performs worse vs. the substring version as the number of content characters between separators grows. It actually starts out performing better than the substring version, by quite a bit (I would think we should be able to optimize there as well, the difference was about half) when the ratio is 1:1 (i.e. splitting "ababababa" on 'a' or "a"), but gets worse as you put more content between the separators. That should be a large clue.

-Steve

Reply via email to