{"push_id":1057513441,"size":1,"distinct_size":1,"ref":"refs/heads/takewhile","head":"31891b7b3357b0d7f3e918fddbc4001e9aab85d8","before":"9f3f1bc119381247f477939ca0dc6d167c97c159","commits":[{"sha":"31891b7b3357b0d7f3e918fddbc4001e9aab85d8","author":{"email":"73675debcd8a436be48ec22211dcf44fe0df0a64@smart-cactus.org","name":"Ben Gamari"},"message":"Inlined Text.takeWhile and takeWhile1\n\nInlining these functions can improve code generation significantly when\nthe predicate is statically known as it avoids boxing every parsed\ncharacter. Unfortunately, marking `takeWhile` itself as `INLINEABLE`\nisn't sufficient to convince GHC to inline it.\n\nMoreover, we refactor things to avoid the allocations associated with\nthe chunk accumulation list unless necessary.\n\nPreviously things looked like,\n\n    benchmarking takeWhile/T isAlpha\n    time                 32.33 μs   (31.70 μs .. 33.25 μs)\n                         0.994 R²   (0.988 R² .. 0.998 R²)\n    mean                 33.02 μs   (32.36 μs .. 33.92 μs)\n    std dev              2.687 μs   (2.086 μs .. 3.476 μs)\n    variance introduced by outliers: 78% (severely inflated)\n\n    benchmarking takeWhile/TL isAlpha\n    time                 71.00 μs   (69.29 μs .. 72.83 μs)\n                         0.991 R²   (0.985 R² .. 0.996 R²)\n    mean                 71.60 μs   (69.94 μs .. 74.58 μs)\n    std dev              7.358 μs   (5.428 μs .. 10.73 μs)\n    variance introduced by outliers: 83% (severely inflated)\n\n    benchmarking takeWhile1/T isAlpha\n    time                 34.64 μs   (33.34 μs .. 36.26 μs)\n                         0.989 R²   (0.985 R² .. 0.994 R²)\n    mean                 34.93 μs   (34.04 μs .. 35.91 μs)\n    std dev              3.249 μs   (2.821 μs .. 3.950 μs)\n    variance introduced by outliers: 82% (severely inflated)\n\n    benchmarking takeWhile1/TL isAlpha\n    time                 68.30 μs   (66.59 μs .. 70.39 μs)\n                         0.994 R²   (0.991 R² .. 0.998 R²)\n    mean                 67.84 μs   (66.53 μs .. 69.77 μs)\n    std dev              5.139 μs   (3.444 μs .. 7.793 μs)\n    variance introduced by outliers: 73% (severely inflated)\n\nNow things look like,\n\n    benchmarking takeWhile/T isAlpha\n    time                 12.22 μs   (12.16 μs .. 12.31 μs)\n                         1.000 R²   (1.000 R² .. 1.000 R²)\n    mean                 12.29 μs   (12.23 μs .. 12.36 μs)\n    std dev              222.0 ns   (180.4 ns .. 280.2 ns)\n    variance introduced by outliers: 16% (moderately inflated)\n\n    benchmarking takeWhile/TL isAlpha\n    time                 43.13 μs   (42.77 μs .. 43.58 μs)\n                         0.999 R²   (0.998 R² .. 1.000 R²)\n    mean                 43.28 μs   (42.85 μs .. 44.06 μs)\n    std dev              1.894 μs   (1.267 μs .. 3.137 μs)\n    variance introduced by outliers: 48% (moderately inflated)\n\n    benchmarking takeWhile1/T isAlpha\n    time                 13.37 μs   (13.22 μs .. 13.57 μs)\n                         0.999 R²   (0.998 R² .. 0.999 R²)\n    mean                 13.29 μs   (13.14 μs .. 13.44 μs)\n    std dev              536.0 ns   (463.2 ns .. 641.2 ns)\n    variance introduced by outliers: 48% (moderately inflated)\n\n    benchmarking takeWhile1/TL isAlpha\n    time                 42.33 μs   (42.18 μs .. 42.59 μs)\n                         0.999 R²   (0.998 R² .. 0.999 R²)\n    mean                 43.72 μs   (43.22 μs .. 44.45 μs)\n    std dev              1.957 μs   (1.491 μs .. 2.486 μs)\n    variance introduced by outliers: 50% (moderately inflated)\n\nMoreover, this produces a similar >3x speedup in an HTML5 parser that I\nhave.","distinct":true,"url":"https://api.github.com/repos/bgamari/attoparsec/commits/31891b7b3357b0d7f3e918fddbc4001e9aab85d8"}]}