faster splitter

qznc via Digitalmars-d digitalmars-d at puremagic.com
Mon May 30 15:16:27 PDT 2016


On Monday, 30 May 2016 at 20:08:46 UTC, Andrei Alexandrescu wrote:
> On 05/30/2016 04:00 PM, Chris wrote:
>> ./benchmark.dmd
>>         std: 178 ±31    +36 (4475)  -29 (5344)
>>      manual: 167 ±46    +82 (2883)  -32 (7054)
>>        qznc: 114 ±7     +18 (1990)   -5 (7288)
>>       Chris: 228 ±49    +82 (3050)  -35 (6780)
>>      Andrei: 103 ±5     +47 ( 658)   -2 (9295)
>> (avg slowdown vs fastest; absolute deviation)
>> CPU ID: GenuineIntel Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
>>
>> LDC:
>>
>>         std: 184 ±19    +28 (3420)  -14 (6523)
>>      manual: 205 ±59   +120 (2463)  -39 (7443)
>>        qznc: 151 ±25    +44 (2983)  -17 (6911)
>>       Chris: 194 ±57    +78 (3702)  -46 (6251)
>>      Andrei: 101 ±2     +42 ( 435)   -1 (9542)
>>   (avg slowdown vs fastest; absolute deviation)
>> CPU ID: GenuineIntel Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
>
> Thanks for looking into this! @qznc, could you please look into 
> updating https://github.com/dlang/phobos/pull/4362 with this 
> result? One possible tweak is see whether replacing the 
> function call with inline code helps. Thanks! -- Andrei

What function call should be replaced with inline code?

Overall, I'm very confused and displeased by the benchmark right 
now. Initially, the problem was that a naive manual find was 
slower than std find in Phobos. Look at the LDC numbers–manual 
find is slower than std find. By tweaking the benchmark, the 
numbers can be shifted around arbitrarily. Even without tweaking, 
it is very processor dependent. Here are the numbers from my 
laptop:

./benchmark.ldc
        std: 149 ±24    +29 (4275)  -21 (5604)
     manual: 129 ±37    +90 (2055)  -23 (7917)
       qznc: 131 ±22    +26 (4381)  -20 (5488)
      Chris: 154 ±35    +81 (2192)  -22 (7672)
     Andrei: 118 ±28    +82 (1762)  -16 (8194)
  (avg slowdown vs fastest; absolute deviation)
CPU ID: GenuineIntel Intel(R) Core(TM) i7 CPU       M 620  @ 
2.67GHz

./benchmark.dmd
        std: 143 ±22    +26 (4219)  -19 (5602)
     manual: 158 ±31    +47 (3436)  -24 (6492)
       qznc: 101 ±2     +12 (1349)   -1 (7851)
      Chris: 216 ±38    +56 (3393)  -28 (6541)
     Andrei: 135 ±31    +48 (3326)  -24 (6589)
  (avg slowdown vs fastest; absolute deviation)
CPU ID: GenuineIntel Intel(R) Core(TM) i7 CPU       M 620  @ 
2.67GHz

And Desktop:

./benchmark.ldc
        std: 129 ±24    +40 (3121)  -17 (6767)
     manual: 129 ±31    +59 (2668)  -21 (7244)
       qznc: 112 ±14    +30 (2542)   -9 (7312)
      Chris: 134 ±33    +58 (2835)  -23 (7068)
     Andrei: 123 ±27    +53 (2679)  -18 (7225)
  (avg slowdown vs fastest; absolute deviation)
CPU ID: GenuineIntel Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz

./benchmark.dmd
        std: 157 ±31    +44 (3693)  -24 (6234)
     manual: 143 ±41    +73 (2854)  -28 (7091)
       qznc: 116 ±21    +35 (3092)  -14 (6844)
      Chris: 181 ±50    +74 (3452)  -38 (6510)
     Andrei: 136 ±38    +64 (2975)  -27 (6953)
  (avg slowdown vs fastest; absolute deviation)
CPU ID: GenuineIntel Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz



More information about the Digitalmars-d mailing list