Parsing benchmark with purescript-backend-optimizer

Here is a comparison of the the parsing benchmarks with normal purs and with purescript-backend-optimizer. It looks like we get approximately the predicted 25%-35% runtime speed improvement.

purs

purs-backend-es

digit 10000

digit 10000

runParser many digit 10000
mean   = 6.98 ms
stddev = 3.15 ms
min    = 5.32 ms
max    = 24.84 ms
runParser many digit 10000
mean   = 5.07 ms
stddev = 2.24 ms
min    = 4.08 ms
max    = 17.23 ms
runParser Array.many digit 10000
mean   = 66.59 ms
stddev = 3.29 ms
min    = 62.86 ms
max    = 79.18 ms
runParser Array.many digit 10000
mean   = 65.25 ms
stddev = 6.22 ms
min    = 59.13 ms
max    = 80.86 ms
StringParser manyRec CodePoints.anyDigit 10000
mean   = 6.07 ms
stddev = 2.55 ms
min    = 4.38 ms
max    = 15.30 ms
StringParser manyRec CodePoints.anyDigit 10000
mean   = 5.34 ms
stddev = 3.12 ms
min    = 3.61 ms
max    = 15.77 ms
StringParser manyRec CodeUnits.anyDigit 10000
mean   = 5.20 ms
stddev = 894.64 μs
min    = 4.18 ms
max    = 14.87 ms
StringParser manyRec CodeUnits.anyDigit 10000
mean   = 3.75 ms
stddev = 779.07 μs
min    = 3.30 ms
max    = 11.59 ms
Regex.match \d* 10000
mean   = 326.68 μs
stddev = 154.33 μs
min    = 287.40 μs
max    = 1.67 ms
Regex.match \d* 10000
mean   = 359.79 μs
stddev = 148.17 μs
min    = 321.54 μs
max    = 1.76 ms

string 100000

string 100000

runParser many string
mean   = 15.36 ms
stddev = 1.15 ms
min    = 14.69 ms
max    = 29.20 ms
runParser many string
mean   = 12.48 ms
stddev = 869.61 μs
min    = 12.00 ms
max    = 21.81 ms
Regex.match literal*
mean   = 372.63 μs
stddev = 140.37 μs
min    = 343.82 μs
max    = 1.78 ms
Regex.match literal*
mean   = 380.45 μs
stddev = 109.01 μs
min    = 353.32 μs
max    = 1.63 ms

many anyChar 10000

many anyChar 10000

runParser many anyChar 10000
mean   = 6.47 ms
stddev = 481.71 μs
min    = 5.96 ms
max    = 8.99 ms
runParser many anyChar 10000
mean   = 4.69 ms
stddev = 743.84 μs
min    = 4.30 ms
max    = 9.51 ms
runParser Array.many anyChar 10000
mean   = 64.24 ms
stddev = 2.93 ms
min    = 59.15 ms
max    = 75.07 ms
runParser Array.many anyChar 10000
mean   = 62.89 ms
stddev = 6.17 ms
min    = 57.17 ms
max    = 79.27 ms
runParser Combinators.Array.many anyChar 10000
mean   = 5.25 ms
stddev = 1.44 ms
min    = 4.43 ms
max    = 13.13 ms
runParser Combinators.Array.many anyChar 10000
mean   = 3.63 ms
stddev = 1.42 ms
min    = 3.04 ms
max    = 11.87 ms

skipMany anyChar 10000

skipMany anyChar 10000

runParser skipMany anyChar 10000
mean   = 3.41 ms
stddev = 405.25 μs
min    = 3.23 ms
max    = 6.04 ms
runParser skipMany anyChar 10000
mean   = 2.29 ms
stddev = 576.75 μs
min    = 2.10 ms
max    = 5.68 ms

sepBy 10000

sepBy 10000

runParser sepBy 10000
mean   = 8.96 ms
stddev = 317.11 μs
min    = 8.30 ms
max    = 10.00 ms
runParser sepBy 10000
mean   = 6.12 ms
stddev = 932.89 μs
min    = 5.62 ms
max    = 11.86 ms

sepEndBy1 10000

sepEndBy1 10000

runParser sepEndBy1 10000
mean   = 6.77 ms
stddev = 410.57 μs
min    = 6.31 ms
max    = 8.06 ms
runParser sepEndBy1 10000
mean   = 4.25 ms
stddev = 736.66 μs
min    = 3.69 ms
max    = 8.50 ms

chainl 10000

chainl 10000

runParser chainl 10000
mean   = 4.50 ms
stddev = 359.53 μs
min    = 4.15 ms
max    = 6.77 ms
runParser chainl 10000
mean   = 2.57 ms
stddev = 642.56 μs
min    = 2.31 ms
max    = 6.45 ms

chainr 1000

chainr 1000

runParser chainr 1000
mean   = 577.30 μs
stddev = 223.46 μs
min    = 488.93 μs
max    = 2.78 ms
runParser chainr 1000
mean   = 347.11 μs
stddev = 207.16 μs
min    = 274.87 μs
max    = 2.73 ms

chainr 10000

chainr 10000

runParser chainr 10000
mean   = 7.08 ms
stddev = 1.38 ms
min    = 6.29 ms
max    = 15.89 ms
runParser chainr 10000
mean   = 4.01 ms
stddev = 779.50 μs
min    = 3.36 ms
max    = 8.54 ms

manyTill 1000

manyTill 1000

runParser manyTill 1000
mean   = 566.07 μs
stddev = 133.10 μs
min    = 478.00 μs
max    = 1.57 ms
runParser manyTill 1000
mean   = 327.56 μs
stddev = 196.24 μs
min    = 262.87 μs
max    = 2.49 ms
runParser manyTill_ 1000
mean   = 541.53 μs
stddev = 75.38 μs
min    = 486.73 μs
max    = 1.04 ms
runParser manyTill_ 1000
mean   = 325.18 μs
stddev = 168.37 μs
min    = 272.96 μs
max    = 2.14 ms

manyTill 10000

manyTill 10000

runParser manyTill 10000
mean   = 6.28 ms
stddev = 626.08 μs
min    = 5.82 ms
max    = 9.81 ms
runParser manyTill 10000
mean   = 3.40 ms
stddev = 440.33 μs
min    = 3.01 ms
max    = 5.95 ms
runParser manyTill_ 10000
mean   = 6.32 ms
stddev = 415.21 μs
min    = 5.85 ms
max    = 8.28 ms
runParser manyTill_ 10000
mean   = 3.40 ms
stddev = 425.61 μs
min    = 3.01 ms
max    = 5.84 ms

mediumJson

mediumJson

runParser json mediumJson
mean   = 3.93 ms
stddev = 836.39 μs
min    = 3.62 ms
max    = 14.30 ms
runParser json mediumJson
mean   = 3.11 ms
stddev = 974.27 μs
min    = 2.66 ms
max    = 15.68 ms
StringParser.runParser json mediumJson
mean   = 7.48 ms
stddev = 1.30 ms
min    = 6.95 ms
max    = 23.57 ms
StringParser.runParser json mediumJson
mean   = 5.67 ms
stddev = 868.81 μs
min    = 5.35 ms
max    = 15.30 ms

largeJson

largeJson

runParser json largeJson
mean   = 13.90 ms
stddev = 767.85 μs
min    = 13.25 ms
max    = 21.03 ms
runParser json largeJson
mean   = 10.84 ms
stddev = 779.30 μs
min    = 10.25 ms
max    = 15.11 ms
StringParser.runParser json largeJson
mean   = 25.30 ms
stddev = 752.66 μs
min    = 24.54 ms
max    = 31.13 ms
StringParser.runParser json largeJson
mean   = 19.73 ms
stddev = 530.79 μs
min    = 19.35 ms
max    = 24.18 ms
8 Likes