Skip to content
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

Compiling aeson-benchmark-dates with GHC 8.0.1 exhausts simplifier ticks #502

Closed
RyanGlScott opened this issue Jan 1, 2017 · 2 comments
Closed

Comments

@RyanGlScott
Copy link
Member

rgscott@gearloose:~/.../Haskell/aeson/benchmarks$ cabal build aeson-benchmark-dates
Preprocessing library aeson-benchmarks-0...
<build output elided>
Preprocessing executable 'aeson-benchmark-dates' for aeson-benchmarks-0...
[1 of 1] Compiling Main             ( Dates.hs, dist/build/aeson-benchmark-dates/aeson-benchmark-dates-tmp/Main.o )

<no location info>: error:
    ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-unknown-linux):
        Simplifier ticks exhausted
  When trying UnfoldingDone io_sUoZ
  To increase the limit, use -fsimpl-tick-factor=N (default 100)
  If you need to do this, let GHC HQ know, and what factor you needed
  To see detailed counts use -ddump-simpl-stats
  Total ticks: 153201

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This was originally reported as GHC Trac #12967, but I suspect that aeson might be inlining too many definitions here. I'll try to minimize this benchmark into something smaller to try and figure out the culprit.

@RyanGlScott
Copy link
Member Author

RyanGlScott commented Jan 1, 2017

This is as small of a test case that I can find:

{-# LANGUAGE OverloadedStrings #-}
module Main (main) where

import Criterion.Main (bench, defaultMain, whnf)
import Data.Aeson (decode, encode)
import Data.Time.Clock (UTCTime)
import qualified Data.ByteString.Lazy as BL (ByteString)

utcTime :: BL.ByteString -> Maybe [UTCTime]
utcTime = decode

main :: IO ()
main = do
  defaultMain [bench "whole" $ whnf encode (utcTime "foo")]

It looks like the aeson-related instances for [] and UTCTime are both contributing to the issue. If I replace [UTCTime] in the type signature for utcTime with something like, say, UTCTime or [Int], the error goes away.

@bergmark
Copy link
Collaborator

This popped up again locally for me for 1.1.1.0. I "resolved" that by increasing the number of ticks from 100 to 200. I guess that this is just waiting for someone to run across this in their own project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants