
#9400: poor performance when compiling modules with many Text literals at -O1 -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Compile- | Blocked By: time performance bug | Related Tickets: #9370 Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): Just to add a bit more detail: * The special handling for singleton string literals is in `MkCore.mkStringExprFS`. Omittign the `lengthFS str == 1` case looks very plausible to me. * Notice that this same function sometimes generates `unpackCStringUtf8` rather than `unpackCString`. Rules that recognise only the latter will stumble if the former is produced. I have no clue what to do about this -- Unicode experts may. * The function `CoreSubst.exprIsConApp_maybe` is the place where we say "does this expression look like a constructor application?". Adding an extra case to `go`, below the ones for `dataConWorkId` and `DFunFunfolding` should let us dynamically expand a call to `unpackCString` into a cons cell. And that will actually be ''better'' than now, because it should eliminate {{{ case "foo" of 'f' : 'o' : xs -> .... }}} Would someone care to try? Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9400#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler