carlohamalainen / ghc-imported-from

For a given Haskell source file, determine where a symbol is imported from
BSD 3-Clause "New" or "Revised" License
26 stars 2 forks source link

Slow operation #24

Open david-christiansen opened 9 years ago

david-christiansen commented 9 years ago

It sometimes takes 2-3 seconds on my machine to find the Haddock page for a particular symbol. Is this normal?

Perhaps some of the information that cabal repl provides to ghc-imported-from could be printed in the output, and then passed as command-line arguments to subsequent invocations? This would let editors cache the information on a per-buffer basis.

david-christiansen commented 9 years ago

Or, alternatively, perhaps this could eventually be folded back into ghc-mod, which already caches all that information?

carlohamalainen commented 9 years ago

The slow operation is normal. Earlier versions were much slower. It does no caching at all and has to partially compile the file (to work out the imports and what symbols really mean) at every invocation. If GHC itself kept some more bookkeeping around then lookups would be very quick.

I'd be happy for ghc-imported-from to be merged into ghc-mod. I thought I'd see if the tool gains any traction before talking to the ghc-mod author.

david-christiansen commented 9 years ago

My understanding is that if it were integrated into ghc-mod as a new command, then the bookkeeping would already be done by the ghc-modi process, right? If so, I'd encourage you to merge it in sooner rather than later, as it would make both tools much more valuable.

carlohamalainen commented 9 years ago

My understanding is that if it were integrated into ghc-mod as a new command, then the bookkeeping would already be done by the ghc-modi process, right?

I think so. I'll look into it.

DanielG commented 9 years ago

@carlohamalainen I'd be happy to merge this (±some cleanup) into ghc-mod if you want to shoot us a PR :3

carlohamalainen commented 9 years ago

@DanielG I'd be happy to merge it in :) What sort of things need to be cleaned up?

DanielG commented 9 years ago

Oh just some refactoring and documentation so I can understand what's going on too. Last time I tried I didn't quite get it.