Changes between Version 7 and Version 8 of Commentary/Compiler/RecompilationAvoidance


Ignore:
Timestamp:
Nov 30, 2007 4:42:51 PM (6 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/RecompilationAvoidance

    v7 v8  
    118118GHC currently does (2), more about that in a minute. 
    119119 
    120 Why not do (1)?  I don't know - perhaps it was hard at the time GHC's 
    121 recompilation checker was designed, because the make dependencies were 
    122 generated by a separate Perl script, which worked by simply grepping 
    123 for `import`.  We consider this option later. 
    124  
    125 In addition to correctness (recompile when necessary), we also want to 
     120Why not do (1)?  Well, then ''every'' time `D.hi` changed, GHC would be 
     121invoked on `A` again.  But `A` doesn't depend directly on `D`: it 
     122imports `B`, and it might be therefore be insensitive to changes in `D`.   
     123By telling make only about direct dependencies, we gain the ability to 
     124avoid recompiling modules further up the dependency graph, by not touching 
     125interface files when they don't change. 
     126 
     127Back to (2).  In addition to correctness (recompile when necessary), we also want to 
    126128avoid unnecessary recompilation as far as possible. 
    127129Make only knows about very coarse-grained dependencies.  For example, 
     
    305307== Alternative design choices == 
    306308 
    307 === ghc -M should record transitive dependencies === 
    308  
    309 We wouldn't have to record usages on entities that are just 
    310 re-exported, and we might get less recompilation. 
    311  
    312 However, this is not so good, because now when modifying a module at the bottom of the dependency graph we have to invoke the compiler on every single module above it: that is, we lost the benefit of the optimisation of not modifying the `.hi` file if it hasn't changed. 
    313  
    314309=== fingerprints instead of versions === 
    315310