What are the standard methods to profile parser written in parser combinator libraries in Haskell?
I'm currently using uu-parsinglib
but I would be very interested in knowing the methods of profiling also other parser combinator libraries like Parsec
.
Right now I have written my parser and it is slow and eats a lot of ram (for 600 lines input text it takes about 5 seconds to parse with more than 1Gb of RAM and I want to investigate how I can improve it)
Try heap profiling:
If the profile looks like a mountain and is in the megabytes, probably you construct a large data structure first and then reduce it (and then could look into using accumulators or memoization).
More detailed info: http://book.realworldhaskell.org/read/profiling-and-optimization.html