Open phadej opened 1 year ago
Prelude Data.Attoparsec.Text Data.Text> fmap signum (parseOnly decimal (Data.Text.replicate 100000 "9") :: Either String Integer) Right 1 (0.32 secs, 4,286,165,576 bytes) Prelude Data.Attoparsec.Text Data.Text> fmap signum (parseOnly decimal (Data.Text.replicate 200000 "9") :: Either String Integer) Right 1 (1.19 secs, 17,092,657,496 bytes) Prelude Data.Attoparsec.Text Data.Text> fmap signum (parseOnly decimal (Data.Text.replicate 400000 "9") :: Either String Integer) Right 1 (4.83 secs, 68,266,651,512 bytes) Prelude Data.Attoparsec.Text Data.Text> fmap signum (parseOnly decimal (Data.Text.replicate 800000 "9") :: Either String Integer) Right 1 (18.86 secs, 272,858,846,272 bytes)
when doubling the size of input the time quadruples.
Tested using cabal build --write-ghc-environment-files=always, and then loading the library into repl. So the important parts are not interpreted.
cabal build --write-ghc-environment-files=always
repl
In comparison, read is almost instant
read
Prelude Data.Attoparsec.Text Data.Text> signum (read (Prelude.replicate 800000 '9') :: Integer) 1 (0.21 secs, 333,060,168 bytes)
I suppose this is this function? https://github.com/haskell/attoparsec/blob/c7ffdbe4e3e92c5c04bfc3a1467d1e2f00668e7b/Data/Attoparsec/Text.hs#L312-L315
@andreasabel yes, but also other versions in attoparsec.
attoparsec
when doubling the size of input the time quadruples.
Tested using
cabal build --write-ghc-environment-files=always
, and then loading the library intorepl
. So the important parts are not interpreted.In comparison,
read
is almost instant