faster splitter
Chris via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 31 12:29:25 PDT 2016
On Tuesday, 31 May 2016 at 18:56:14 UTC, qznc wrote:
>
> The mistake is to split on "," instead of ','. The slow
> splitter at the start of this thread searches for "\r\n".
>
> Your lazy-skip algorithm looks great!
>
> ./benchmark.ldc
> Search in Alice in Wonderland
> std: 168 ±6 +29 ( 107) -3 ( 893)
> manual: 112 ±3 +28 ( 81) -1 ( 856)
> qznc: 149 ±4 +30 ( 79) -1 ( 898)
> Chris: 142 ±5 +28 ( 102) -2 ( 898)
> Andrei: 153 ±3 +28 ( 79) -1 ( 919)
> Andrei2: 101 ±2 +34 ( 31) -1 ( 969)
> Search random haystack with random needle
> std: 172 ±19 +61 ( 161) -11 ( 825)
> manual: 161 ±47 +73 ( 333) -35 ( 666)
> qznc: 163 ±21 +33 ( 314) -15 ( 661)
> Chris: 190 ±47 +80 ( 302) -33 ( 693)
> Andrei: 140 ±37 +60 ( 315) -27 ( 676)
> Andrei2: 103 ±6 +57 ( 64) -2 ( 935)
> (avg slowdown vs fastest; absolute deviation)
> CPU ID: GenuineIntel Intel(R) Core(TM) i7 CPU M 620 @
> 2.67GHz
>
> The Alice benchmark searches Alice in Wonderland for "find a
> pleasure in all their simple joys" and
> finds it in the last sentence.
Would it speed things up even more, if we put the function
`computeSkip` into the loop or is this done automatically by the
compiler?
More information about the Digitalmars-d
mailing list