hadrian icon indicating copy to clipboard operation
hadrian copied to clipboard

Improve the zero build time

Open ndmitchell opened this issue 8 years ago • 7 comments

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 avatar Mar 21 '16 21:03 ndmitchell

@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.

snowleopard avatar Mar 21 '16 23:03 snowleopard

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.

ndmitchell avatar Mar 22 '16 20:03 ndmitchell

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?

snowleopard avatar May 04 '16 00:05 snowleopard

Add needPath :: [Path] -> Action ()? Less ugly, more explicit, and need isn't common enough that those 4 characters really matter.

ndmitchell avatar May 04 '16 05:05 ndmitchell

@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.

snowleopard avatar May 04 '16 12:05 snowleopard

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.

ndmitchell avatar May 04 '16 18:05 ndmitchell

Agreed. And I'll see whether I can simply use unifyPath more sparingly, not in every -/- invocation.

snowleopard avatar May 04 '16 18:05 snowleopard