Skip to content

Performance regression in bsb-http-chunked from GHC-8.6.5 to GHC-8.8.1

Some benchmarks in the bsb-http-chunked package are up to ~13% slower with GHC-8.8.1 when compared with GHC-8.6.5.

A diff of the Core of the relevant module can be viewed here. Virtually all changes are in the demand analysis annotations, so I suspect that this is the cause of the slowdown. The module depends only on base and bytestring, and bytestring didn't have any relevant code changes from v0.10.8.2 to v0.10.9.0.

I don't really understand demand analysis, but one questions that popped up was, why multiple let-bindings lost their [Dmd=<S,U>] annotation although they are used in case analyses right after their definitions. For example outRemaining:

              let {
                outRemaining :: ghc-prim-0.5.3:GHC.Prim.Int#
                [LclId]
                outRemaining = ghc-prim-0.5.3:GHC.Prim.minusAddr# ww1 ww } in
              case ghc-prim-0.5.3:GHC.Prim.<# outRemaining 23# of {

Another question is why a join point binding previously called exit, was renamed to w$j and gained the annotation InlPrag=NOUSERINLINE[2].

                          join {
                            $w$j [InlPrag=NOUSERINLINE[2], Dmd=<C(S),C(U(U,U))>]
                              :: ghc-prim-0.5.3:GHC.Prim.State# ghc-prim-0.5.3:GHC.Prim.RealWorld
                                 -> (# ghc-prim-0.5.3:GHC.Prim.State#
                                         ghc-prim-0.5.3:GHC.Prim.RealWorld,
                                       BuildSignal r #)
                            [LclId[JoinId(1)], Arity=1, Str=<L,U>]
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information