-
Notifications
You must be signed in to change notification settings - Fork 711
Suboptimal parseInstalledPackageInfo performance #2276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Bad performance of the parser is a known issue. @dcoutts has written a new Parsec-based parser, but it hasn't been merged yet. |
@dcoutts, I wouldn't mind applying the patch locally if it's easy enough to backport to ghc 7.8.3. |
My workaround for this was to split the long comma separated list of ld-options into multiple ld-options with one item per line as the following program doesn't exhibit the pathology: import Distribution.InstalledPackageInfo main = print $ length $ show $ parseInstalledPackageInfo $ unlines $ take 20000 (repeat "ld-options: x") |
Fixed in #5017 |
My search for ghc-pkg memory consumption described in https://ghc.haskell.org/trac/ghc/ticket/9885 led me to parseInstalledPackageInfo. The following simple program will eat up 8G of memory:
The memory profile looks something like this:
(953)>>=...(...)
>>=..
>>=.
>>=
many1
many
sepBy1
sepBy
parseSepList
parseOptCommaList
listField
installedFieldDescrs
accumFields.setField
accumFields
parseFieldsFlat.
parseFieldsFlat
parseInstalledPackageInfo
parsePackageInfo
registerPackage
runit
main 794023536
The text was updated successfully, but these errors were encountered: