hadrian
hadrian copied to clipboard
Improve the zero build time
Zero build time is currently non-zero. I should fix that. See https://github.com/snowleopard/shaking-up-ghc/issues/218 for some initial analysis.
@ndmitchell What's your opinion on the newtype Path
proposal? Shall I proceed with the refactoring? This may be useful even if it turns out to be not on the critical path of the zero build: ensuring that Path
is always unified seems to be the right thing to do.
Seems sensible - if you think it's going to be clearer that's a good reason to do it anyway. Once done, it will certainly be easier to leverage for performance as well, if not a performance win on its own.
Tried to make some progress with newtype Path
but stumbled over the problem that I can't use need
on a Path
without doing fromPath
first, which looks ugly...
I could, perhaps, hide Shake's need
and wrap it in my own need :: [Path] -> Action ()
. Although this may be confusing for users of the build system, it has the advantage that now we cannot accidentally call need
on a FilePath
. @ndmitchell Do you have a better solution in mind?
Add needPath :: [Path] -> Action ()
? Less ugly, more explicit, and need
isn't common enough that those 4 characters really matter.
@ndmitchell Agreed, this looks like the best solution, although still not ideal...
Alas, it looks like I'm opening a big can of worms: there are many useful operators like <.>
, -<.>
, etc. which I won't be able to re-use without some syntactic overhead. Even some %>
rules will break as there are use-cases like path <//> "*" <.> osuf way %> \obj -> do ...
where path :: Path
.
I think the resulting noise is too high price to pay for type-safety :-(
P.S.: The only solution I see to avoid the noise is to wrap all Shake's primitives into Path
. Which doesn't seem to be satisfactory either.
Sure, and it doesn't really bring us much safety, its mostly an optimisation. Let me rework some internal pieces of Shake (currently ongoing) and then circle back and see what effect we can have on zero builds.
Agreed. And I'll see whether I can simply use unifyPath
more sparingly, not in every -/-
invocation.