D-Programming-Language/phobos — pull request #1210 by Kozzi11 (2013-03-17 16:43:43+00:00)
Title: Improve splitter speed

auto message = "Some text with separators\n";
foreach(index; 0 .. 10)
{
message ~= message;
}

auto t1 = Clock.currTime();
foreach(i; 0..100_000)
{
foreach(notused; splitter(message, '\n'))
{
}
}
writeln(Clock.currTime()-t1);

BEFORE:
dmd: 1 minute, 19 secs, 651 ms, 13 μs, and 5 hnsecs
gdmd: 1 minute, 29 secs, 379 ms, 177 μs, and 4 hnsecs
ldmd2: 1 minute, 22 secs, 290 ms, 900 μs, and 8 hnsecs

AFTER:
dmd: 12 secs, 878 ms, 39 μs, and 3 hnsecs
gdmd: 15 secs, 608 ms, 382 μs, and 9 hnsecs
ldmd2: 16 secs, 811 ms, 238 μs, and 4 hnsecs

BEFORE: (-O -noboundscheck -inline -release)
dmd: 20 secs, 134 ms, 786 μs, and 9 hnsecs
gdmd: 13 secs, 679 ms, 102 μs, and 6 hnsecs
ldmd2: 9 secs, 421 ms, 65 μs, and 6 hnsecs

AFTER: (-O -noboundscheck -inline -release)
dmd: 5 secs, 993 ms, 687 μs, and 5 hnsecs
gdmd: 3 secs, 694 ms, 773 μs, and 6 hnsecs
ldmd2: 2 secs, 593 ms, 357 μs, and 2 hnsecs

// test with double quotes ("\n")

BEFORE:
dmd: 26 secs, 105 ms, 729 μs, and 3 hnsecs
gdmd: 30 secs, 641 ms, 469 μs, and 9 hnsecs
ldmd2: 35 secs, 476 ms, 544 μs, and 1 hnsec

AFTER:
dmd: 12 secs, 878 ms, 39 μs, and 3 hnsecs
gdmd: 15 secs, 608 ms, 382 μs, and 9 hnsecs
ldmd2: 16 secs, 811 ms, 238 μs, and 4 hnsecs

BEFORE: (-O -noboundscheck -inline -release)
dmd: 7 secs, 776 ms, and 972 μs
gdmd: 4 secs, 437 ms, 760 μs, and 5 hnsecs
ldmd2: 6 secs, 297 ms, 791 μs, and 4 hnsecs

AFTER: (-O -noboundscheck -inline -release)
dmd: 7 secs, 131 ms, 397 μs, and 9 hnsecs
gdmd: 3 secs, 649 ms, 701 μs, and 2 hnsecs
ldmd2: 5 secs, 203 ms, 217 μs, and 2 hnsecs