-
Notifications
You must be signed in to change notification settings - Fork 175
Support multiple projects with a single ghc-modi instance #253
Comments
What version of ghc-mod are you using and what operation exactly is taking long? What kind of disk are you using, and can you try |
I'm using an SSD drive with i7 quad core processor.
I've tried ghc-mod type, which in a sample yesod app is
in a trivial 30 line source file
It seems that when I invoke :GhcModType in VIM it takes a bit longer, but that's probably expected. Just for comparison here's
|
It's also probably worth mentioning, that if I run |
hmm I was going to do some profiling and possibly optimization of ghc-mod anyways so I'll see if I can find out why it's so slow when I get around to it. In the meantime you might want to suggest to the author of your VIM plugin to add support for |
As it turns out you were right. I tried using I thought that maybe as a workaround I could write a wrapper script on Does that sound reasonable, or do you think there's a better way to solve this? |
That sounds like a pretty good workaround. |
Maybe, ghc-mod should provide such a feature if possible. |
@kazu-yamamoto It shouldn't be too hard to implement. I haven't looked at ghc-mod source code yet. But out of curiosity I wrote a small wrapper as described which runs ghc-modi on background and communicates with the client via a unix socket. Here's a proof of concept https://github.com/darthdeus/ghc-modi-wrapper. It will be a lot easier if this is done in ghc-mod itself, since all the necessary logic is already there and we would just need to add something like |
Yes, I think you are right. If you kindly contribute such a code, it would be highly appreciated. |
Yeah, I was thinking about that. Doing a bunch of caching stuff and speeding up ghc-mod is definitely on my TODO list anyways. I was mostly thinking about speeding up module/function completion by having a frontend with minimal dependencies that checks a cache and calls the real ghc-mod executable on demand if the cache is invalid or nonexistent (minimal dependencies because on some of my slower machines with little memory just loading the 200MiB+ ghc-mod executable takes a considerable amount of time and caching doesn't help much because I have so little memory on those machines that the cache gets constantly invalidated). So having a long running ghc-mod process that we can query as well when a look up fails (or is something we can't cache properly like the type) would fit this model pretty well too but for the sake of supporting machines with scarce memory weather or not we spawn a server process should probably be configurable. |
I agree that this should be configurable. I also have a tiny laptop which barely runs anything, so I can totally see that usecase. So I guess I'll try to port my gem to ghc-mod and see how it works out. |
Just in case, I designed that one |
But running multiple |
Apart from the insane memory consumption ;) |
Allowing multiple projects in ghc-modi shouldn't be too hard basically you need seperate |
As @DanielG said, there is no problem to run multiple ghc-modi (except memory usage). Emacs front-end actually does this. To support multiple packages in ghc-modi, the protocol should be changed so that clients can identify their packages. |
Before merging the pull request above, I would like to make consensus on two items:
For (1): For (2): if a sandbox is used, the cache of package may be small enough at this moment. But if not, all user packages, which may be large, should be cached. This is a problem described in #243. We need to consider how to manage the cache efficiently when multiple packages are supported. This issue is not caused by multiple packages but I would like to discuss at the same time. Honestly, I have no idea to resolve this. |
I would just add a command line option (like |
According to IRC chat with @DanielG, we will not implement the server (daemon) feature (at least in the near future). ghc-modi is designed as an interactive process like shell, not a server. This design ensures that ghc-modi is certainly terminated, for example, by Emacs. The problem of multiple lib/exec/test-suites in a package should be fixed in the |
I think you misunderstood, I do plan to make |
Let me clarify:
|
|
OK, I understand. |
Is one daemon executed on a PC node? Or is one daemon executed for each Haskell project? |
I'm not sure yet, I'll decide when I get around to that. |
I'm worry about how to ensure that the daemon is terminated. |
Also, I'm afraid that daemons cannot be implemented on Windows because the "unix" package is necessary. |
Well every frontend process (
|
To daemozie a process, |
Oh, I see what you mean. There is a way to do it on windows I'm sure, I'll check once I get around to it. As a fallback we could simply disable the demonetization on windows and start the daemon in a separate IO thread. |
@DanielG @kazu-yamamoto is this still happening or? what's the status? |
I got stuck working on the wire protocol because university started up again, but this is certainly still on the roadmap, it's just a matter of when ;) |
I think this has become out of scope for ghc-mod and is going to be implemented in haskell-ide-engine instead. |
I'm not sure if I'm not doing something wrong, but I've just installed
ghc-mod
after usinghdevtools
for a while, and found that it's order of magnitude slower, even on a small project (2-5 seconds, while hdevtools was kinda instant).I asked around on IRC and people told me that it runs pretty fast for them, so I'm not sure if I could me missing something? I also have a clean install of GHC 7.8.2, maybe there's a performance regression on the newer version? (I'm not sure if that's even possible)
The text was updated successfully, but these errors were encountered: