Re: Importing instances without pangling Make
> At the time of writing, I am waiting for yet another long Haskell re-make of > lots of modules to complete. The frustrating thing is, that at least 90% of > these > remakes are actually completely unnecessary. I'm afraid I've not gone through your detailed suggestions, but in the short term, would a crude hack that I used to use with Algol68C help? For that I forced the compiler to output interface files to somewhere temporary and then used diff on them to see if there were any substantive differences. If there were none, (and compilations referring to them would therefore behave no differently) I would not copy the temporary version into the real place. All in a wrapper script around the compiler, of course. Jón -- Jón Fairbairn [EMAIL PROTECTED] 18 Kimberley Road[EMAIL PROTECTED] Cambridge CB4 1HH+44 1223 570179 (after 14:00 only, please!)
Re: Importing instances without pangling Make
> Suppose that B had imported C only > to export it again (either by listing it in the export list, or not > having any export list at all). Wrong. If B imports C and has no export list, nothing from C is re-exported, only definitions from B itself, with the single exception of C's instance decls. Regards, Malcolm
Re: Importing instances without pangling Make
George Russell wrote: > This scheme is not the cleverest that could be devised. For example it is > still necessary to recompile whole chains of modules if you add an import > declaration. (Not to a system library, imports from those are counted as > "stable" in GHCs and my system.) To fix this you would need to keep more > information in the .hi file. Actually we can catch most of these cases too. Alter algorithm A so that if we have no changes to instances declarations in this file, the version numbers in directly imported modules are all the same, and the only change is that we import some modules we didn't import before, then only bump the version number if the import leads to new modules being imported which contain instance declarations. I think you can compute this at very close to zero cost at the start of compilation, when you are doing the imports.
Re: Importing instances without pangling Make
Malcolm Wallace wrote: > Wrong. If B imports C and has no export list, nothing from C is > re-exported, only definitions from B itself, with the single exception > of C's instance decls. OK, but this has no influence at all on my suggestions except to make them work slightly better.
Re: Importing instances without pangling Make
George Russell wrote: > [...] Supposing you now make a change to C. For example, suppose > you add a line >pangle = "pangle" > to the end of C, and add "pangle" to the list of exports from C. > Then you recompile C. You will find that C.hi now has a new version > number "2". Strange, this is not the case with my version of GHC (from the CVS repository two days ago). > Also of course the values which are also listed in the .hi file are > changed. > > Now recompile B. You will then find that even though the interface > to B is precisely the same, the version number attached to B.hi > is bumped up by one. Thus B.hi is updated and you then get a > completely unnecessary recompilation of A, since A.o depends on > B.hi. [...] Adding -recomp to GHC's flags should be an improvement for your kind of problem in any case. Although make still thinks it's time to recompile some .hs files, GHC is more clever and does *not* recompile in most cases when it can be avoided. Cheers, Sven -- Sven PanneTel.: +49/89/2178-2235 LMU, Institut fuer Informatik FAX : +49/89/2178-2211 LFE Programmier- und Modellierungssprachen Oettingenstr. 67 mailto:[EMAIL PROTECTED]D-80538 Muenchen http://www.informatik.uni-muenchen.de/~Sven.Panne
Re: Importing instances without pangling Make
Jon Fairbairn wrote: > I'm afraid I've not gone through your detailed suggestions, but in the > short term, would a crude hack that I used to use with Algol68C help? No, fraid not. GHC already does this hack anyway. Algol68C didn't have interface declarations. Still, nice to find someone else who remembers it.
RE: Importing instances without pangling Make
Seems like you're not using -recomp. --sigbjorn > -Original Message- > From: George Russell [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 25, 2000 8:53 AM > To: [EMAIL PROTECTED] > Subject: Importing instances without pangling Make > >
Re: Importing instances without pangling Make
Sigbjorn Finne wrote: > > Seems like you're not using -recomp. No I'm not. What about documenting it somewhere?
Re: Importing instances without pangling Make
Sven Panne wrote: > George Russell wrote: > > [...] Supposing you now make a change to C. For example, suppose > > you add a line > >pangle = "pangle" > > to the end of C, and add "pangle" to the list of exports from C. > > Then you recompile C. You will find that C.hi now has a new version > > number "2". > > Strange, this is not the case with my version of GHC (from the CVS > repository two days ago). Ooops, too quick! :-} I didn't read closely enough and didn't add `pangle' to the export list... Anyway, in my experience -recomp plus explicit import lists are a big gain in recompilation time. Cheers, Sven -- Sven PanneTel.: +49/89/2178-2235 LMU, Institut fuer Informatik FAX : +49/89/2178-2211 LFE Programmier- und Modellierungssprachen Oettingenstr. 67 mailto:[EMAIL PROTECTED]D-80538 Muenchen http://www.informatik.uni-muenchen.de/~Sven.Panne
Re: Importing instances without pangling Make
George Russell wrote: > > Sigbjorn Finne wrote: > > > > Seems like you're not using -recomp. > No I'm not. What about documenting it somewhere? I take that back. I AM using it in the big program I mentioned, but I still get huge swathes of unnecessary compilations. Maybe it needs to be still cleverer.
RE: Importing instances without pangling Make
George Russell <[EMAIL PROTECTED]> writes: > > Sigbjorn Finne wrote: > > > > Seems like you're not using -recomp. > No I'm not. What about documenting it somewhere? > I think that's a fine suggestion which GHC HQ will probably do something about (Section 3.7.4 doesn't actually mention it by name.) Re: recomp checker, Patrick Sansom wrote up a paper about it (see http://www.dcs.gla.ac.uk/~sansom/ ) - Simon has improved and modified the story a bit since then, but the underlying idea is still very much the same. --sigbjorn
RE: Importing instances without pangling Make
> There is another less serious problem. Suppose that B had > imported C only > to export it again (either by listing it in the export list, or not > having any export list at all). However I think the best way to deal > with this is simply to copy over all the types and other information > from C's .hi file to B's. This is what GHC used to do, before version 2.00. There are one or two tradeoffs; interface files can get really big if they include all the declarations for entities they export, when there's a level of indirection we quite often don't need to read the original interface file if the importing module doesn't need anything from it. When you duplicate information in interface files, you might end up importing several copies of the same function via different routes, so in the end I think it was decided that the cleanest solution would be to have one and only one copy of each declaration. Cheers, Simon
RE: Importing instances without pangling Make
> Sigbjorn Finne wrote: > > > > Seems like you're not using -recomp. > No I'm not. What about documenting it somewhere? Good point. I'll add a note about it. Perhaps -recomp should be the default? Cheers, Simon
RE: Importing instances without pangling Make
| At the time of writing, I am waiting for yet another long | Haskell re-make of | lots of modules to complete. The frustrating thing is, that | at least 90% of these | remakes are actually completely unnecessary. I've often wondered how to improve this. I'm very reluctant to duplicate information into other .hi files. A .hi file contains a lot of info about each fn: type, arity, unfolding, etc etc. Duplicating this will give rise to much bigger interface files (worst-case quadratic bigger). And with -O on, quite small changes near the bottom may still percolate up the tree. The point is that an *exporter* does not know how the *importer* is going to use his imports. HOWEVER, I think we could do better when you don't use -O. Then much less is put into interface files, and most especially there are no unfoldings. Suppose A imports B, and B imports C. Supose we recompile C and B, and B.hi does not change. Do we need to recompile A? Well, yes if anything A imports from B came from C, and C.hi has changed. So I think we could get away with the rule: bump B.hi's version if anything B exports from C has a higher version number than last time (This isn't enough if C is compiled with -O, because the export from C might not have changed, but something that export mentions in its unfolding might have.) I havn't thought this through fully, though. More for the to-do list. Simon
Re: Importing instances without pangling Make
Part of the problem right now seems to be that GHC is wrongly rewriting (or perhaps touching) the .hi file even though nothing in it is altered. (This is clear because -hi-diffs is also on and not reporting anything). Thus even though I'm using -Onot -recomp it's still recompiling everything.
RE: Importing instances without pangling Make
| At the time of writing, I am waiting for yet another long | Haskell re-make of | lots of modules to complete. The frustrating thing is, that | at least 90% of these | remakes are actually completely unnecessary. OK, I have heard your cries, and have fixed GHC. Try it. Simon
Re: Importing instances without pangling Make
Simon Peyton-Jones wrote: > > | At the time of writing, I am waiting for yet another long > | Haskell re-make of > | lots of modules to complete. The frustrating thing is, that > | at least 90% of these > | remakes are actually completely unnecessary. > > OK, I have heard your cries, and have fixed GHC. > Try it. Many thanks. I will, tomorrow . . .