I made a benchmark program for purescript-parsing which benchmarks against this purescript-string-parsers package.
https://github.com/purescript-contrib/purescript-parsing/blob/main/bench/Main.purs
Here are the results of benchmarking many anyDigit
Text.Parsing.StringParser.CodePoints
StringParser.runParser parse23Points
mean = 746.70 ms
stddev = 12.21 ms
min = 738.42 ms
max = 794.27 ms
Text.Parsing.StringParser.CodeUnits
StringParser.runParser parse23Units
mean = 10.10 ms
stddev = 1.13 ms
min = 9.46 ms
max = 24.07 ms
Text.Parsing.Parser.String
runParser parse23
mean = 44.20 ms
stddev = 6.38 ms
min = 42.25 ms
max = 113.16 ms
Data.String.Regex
Regex.match pattern23
mean = 728.23 μs
stddev = 339.32 μs
min = 613.72 μs
max = 2.97 ms
There is something terribly wrong with Text.Parsing.StringParser.CodePoints.anyDigit and I think I know what. The problem is that codePointAt is linear, so many anyDigit then becomes quadratic.
(EDIT deleted notes about stuff not related to this issue)
I made a benchmark program for purescript-parsing which benchmarks against this purescript-string-parsers package.
https://github.com/purescript-contrib/purescript-parsing/blob/main/bench/Main.purs
Here are the results of benchmarking
many anyDigitText.Parsing.StringParser.CodePoints
Text.Parsing.StringParser.CodeUnits
Text.Parsing.Parser.String
Data.String.Regex
There is something terribly wrong with
Text.Parsing.StringParser.CodePoints.anyDigitand I think I know what. The problem is thatcodePointAtis linear, somany anyDigitthen becomes quadratic.(EDIT deleted notes about stuff not related to this issue)