Changes between Version 4 and Version 5 of NestedCPR


Ignore:
Timestamp:
Dec 11, 2013 3:16:14 PM (15 months ago)
Author:
nomeata
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NestedCPR

    v4 v5  
    3434Baseline: 49832, `better-ho-cardinality`: 49968. Unfortunately, the changes to, for example, `GHC.Read` are not small, and probably mostly benign... 
    3535 
     36Trying to minimize the problem. This code has an increase in allocation (from 49448 to 49544) 
     37{{{ 
     38#!haskell 
     39import Text.Read 
     40import Text.ParserCombinators.ReadPrec 
     41main = (readPrec_to_S readPrec 0 "True":: [(Bool, String)]) `seq` return () 
     42}}} 
     43while copying the definition of `readPrec` here, i.e. 
     44{{{ 
     45#!haskell 
     46 
     47import qualified Text.Read.Lex as L 
     48 
     49import Text.Read 
     50import Text.ParserCombinators.ReadPrec 
     51 
     52foo=parens 
     53    ( do L.Ident s <- lexP 
     54         case s of 
     55           "True"  -> return True 
     56           "False" -> return False 
     57           _       -> pfail 
     58    ) 
     59 
     60 
     61main = (readPrec_to_S readPrec 0 "True":: [(Bool, String)]) `seq` return () 
     62}}} 
     63yields a decrease (49240 → 49224). 
     64 
     65 
     66It even happens with `read "True" :: Bool` So I tried to minimize the problem, which somehow seems to occur in the depths of the `Read` code. But after manually pasting all the related pieces from `GHC.Read` and `Text.ParserCombinators.ReadP*` in one file, the differences in allocations go away. 
     67 
     68Maybe it is related to what inlining information about various functions cross module boundaries. For example, `fMonadP_$cfail` and other functions from `Text.ParserCombinators.ReadP` lose the `InlineRule (1, True, True)` annotation. Is that expected? Also, functions returning a `ShowS` have their arity increased. Can that be a reason for the increase of allocations? 
     69 
    3670=== Side tracks === 
    3771