ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Reload very slow on project, instant in ghci #355

Open seanhess opened 2 years ago

seanhess commented 2 years ago

I have an older project that I recently opened up to perform some updates. My new workflow includes ghcid, but reloads are too slow to be usable.

When I first run ghcid it compiles all the modules, as expected. However, when I save a file, ghcid takes about a minute to update. If I run the project in GHCI it reloads instantly.

Any idea what is going on?

Here is more info if it is helpful:

ndmitchell commented 2 years ago

If you run stack ghci --test --bench --no-load --ghci-options=-fno-code --ghci-options=-fno-break-on-exception --ghci-options=-fno-break-on-error --ghci-options=-v1 --ghci-options=-ferror-spans --ghci-options=-j does it go equally slow? If it does, then that's odd, as that's all ghcid is doing. If it doesn't, try removing options one by one. It might be that -j upsets Rosetta in some way. If you can find a command that works nicely, using -c the_command explicitly should fix ghcid, and I'd be keen to add whatever is the problem to the docs.

archaeron commented 2 years ago

it's also very slow for me. And I thought it might be faster if I set the polling to 1 (--polling=1)

The weird thing is that sometimes it works as intended and very quickly and then it can break on save and not work again after reloading.

Could it be that newer GHC changed the output format of warning and errors?

Altough the same project works great on linux, so maybe on mac the format is different?

mjrussell commented 2 years ago

Im seeing also slower times from ghcid compared to stack ghci or stack repl. I noticed with the --test flag, it looks like its no longer interpreted, i.e its missing , interpreted ) at the end of each file.

Totally possible this has been the behavior in ghcid for a while, but wanted to throw that out there

ndmitchell commented 2 years ago

Changing the polling probably won't help, but it could make things worse, as if you don't pass that, it uses inotify which is very likely to be faster. I don't think the Mac format is different, but GHC does regularly tweak the format. If you pass --verbose to Ghcid it might give you clues about what is happening. Ghcid runs a command line, so you probably need to compare the command line it uses vs the one you are comparing. If you pass -c "stack ghci" then you can have it use stack ghci itself.