I posted this in https://github.com/purescript/purescript/issues/3557:
I have a test project that implements a React based calculator web app. It has two .purs source files and a number of dependency for a total of 456 folders in the output/ directory after compilation completes. I did some tests and incremental builds take long that I would expect them to. Here’s the data:
full build: 10.47s rebuild (no changes): 2.93s rebuild (trivial change to src/Calculator.purs): 3.18s
I assume that rebuilds require parsing and traversing dependencies to make sure that everything still makes sense in Calculator.purs after my change. If that is indeed the case, is there anyway that that data can be cached between runs? I tried
pulp --watch buildand it also takes about 3 seconds after making a change to Calculator.purs.
@hdgarrood suggested a couple of issues that might help with this:
- Use content hashes to determine whether a file needs to be recompiled: https://github.com/purescript/purescript/issues/3145
- Building against pre-compiled dependencies: https://github.com/purescript/purescript/issues/2477
- Integrate purescript-cst: https://github.com/purescript/purescript/issues/3555
As someone who has almost no experience with the purescript code base, the first two seem more feasible in the short term.
I’m curious how people feel about adding a “watch” mode to
purs compile or it would make more sense for
purs compile to do a better job of handling incremental builds and let
pulp handle the watching. If
purs was responsible for watching then we probably wouldn’t need to worry about computing hashes of all of the files each time.