On Tuesday, 31 May 2016 at 18:31:47 UTC, Andrei Alexandrescu wrote:
On 5/31/16 1:54 PM, qznc wrote:
Using a one-letter needle string is more like a user mistake than
something to optimize for.

How is splitting on ',' a user mistake? -- Andrei

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.

Reply via email to