
#10980: Deriving Read instance from datatype with N fields leads to N^2 code size growth -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by slyfox): Replying to [comment:5 simonpj]:
Slyfox, can you give a small example of what the code looks like before and after your change? I can see that turning 4 lines into 1 (by creating a new function definition) is good, but at best that makes it 4 times smaller, which is not the difference between linear and quadratic.
I've rechecked the measurement and you are correct! Quadratic behaviour stil presents in manually converted sources. Seems I was looking at the wrong binary files when tweaking things. Apologies for the confusion :( (for completness) attaching source file before and after transformation for 200-entries file: {{{ $ ghc -c -fforce-recomp -c -O1 M_200_auto.hs $ ghc -c -fforce-recomp -c -O1 M_200_manual.hs $ size M_200_auto.o M_200_manual.o text data bss dec hex filename 3268679 41520 0 3310199 328277 M_200_auto.o 674695 16424 0 691119 a8baf M_200_manual.o }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10980#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler