Closed princemaple closed 11 years ago
Do you have 'cache/cabal/cabal.json' in your 'Sublime Haskell' package folder?
Loading cache in my case takes 2-3 seconds.
It exists, but it only has {}
in it. So, it is not caching for me. Any ideas why? Yes, two bytes only.
If you remove 'cache' folder, restart Sublime and wait until it loads standard modules, will 'cabal.json' be the same? Also, if you have any opened cabal projects, check contents of 'cache/projects'. Are they empty too?
Open Sublime console (ctrl+`), then type:
import autocomplete as a
a.autocompletion.database.cabal_modules.object['cabal'].keys()
It will print module names from cabal, for which info is loaded. If it is ok, try this:
import cache
cache.encode_json(a.autocompletion.database.cabal_modules.object['cabal'], indent = 2)
It will produce string, that normally must be in cabal.json.
Will try tomorrow, 1:00am here, got to sleep :)
[sent from mobile phone] On 01/05/2013 12:49 AM, "Alexandr Ruchkin" notifications@github.com wrote:
If you remove 'cache' folder, restart Sublime and wait until it loads standard modules, will 'cabal.json' be the same? Also, if you have any opened cabal projects, check contents of 'cache/projects'. Are they empty too?
Open Sublime console (ctrl+`), then type:
import autocomplete as a a.autocompletion.database.cabal_modules.object['cabal'].keys()
It will print module names from cabal, for which info is loaded. If it is ok, try this:
import cache cache.encode_json(a.autocompletion.database.cabal_modules.object['cabal'], indent = 2)
It will produce string, that normally must be in cabal.json.
— Reply to this email directly or view it on GitHubhttps://github.com/SublimeHaskell/SublimeHaskell/issues/60#issuecomment-17231738 .
[]
and
'{}'
It's the same if I comment out all the user setting for SublimeHaskell. I only have
"auto_completion_popup": true,
"enable_hdevtools": false
anyways.
Any idea?
Try to
import autocompletion as a
a.autocompletion.module_completions.object['cabal']
It must output names standard modules (not loaded yet, just names)
As loading lasts for ~112 seconds, seems, that this list is not empty.
Then try to load info for any module, for example, for Data.List:
import util
util.browse_module('Data.List')
In my case, I get this:
>>> import util
>>> util.browse_module('Data.List')
<symbols.Module object at 0x000000000F508C50>
>>> util.browse_module('Data.List').declarations.keys()
[u'all', u'unfoldr', u'notElem', u'dropWhile', u'find', u'group', u'mapAccumL', u'init', u'findIndices', u'mapAccumR', u'splitAt', u'unzip', u'scanr1', u'unzip5', u'unwords', u'unlines', u'foldl1', u'break', u'tails', u'words', u'unzip4', u'insert', u'unzip6', u'unzip7', u'genericReplicate', u'unzip3', u'drop', u'genericDrop', u'foldr', u'deleteBy', u'intersectBy', u'repeat', u'genericSplitAt', u'foldl', u'scanl1', u'nub', u'groupBy', u'zip5', u'zip4', u'stripPrefix', u'sum', u'unionBy', u'intersect', u'transpose', u'foldr1', u'genericTake', u'subsequences', u'intersperse', u'zipWith7', u'zipWith6', u'zipWith5', u'zipWith4', u'zipWith3', u'last', u'reverse', u'intercalate', u'filter', u'length', u'deleteFirstsBy', u'or', u'minimumBy', u'scanl', u'nubBy', u'findIndex', u'span', u'zip', u'union', u'tail', u'concatMap', u'replicate', u'zipWith', u'scanr', u'sort', u'head', u'sortBy', u'genericIndex', u'maximum', u"foldl' :: (a -> b -> a) -> a -> [b] -> a", u'isPrefixOf', u'delete', u'and', u'maximumBy', u'takeWhile', u'permutations', u'zip3', u'minimum', u'insertBy', u'null', u'any', u'genericLength', u'zip7', u'zip6', u'lookup', u'take', u"foldl1' :: (a -> a -> a) -> [a] -> a", u'map', u'product', u'elemIndices', u'isInfixOf', u'dropWhileEnd', u'iterate', u'concat', u'cycle', u'isSuffixOf', u'partition', u'lines', u'elem', u'elemIndex', u'inits']
I think, you'll get None
. The only reason for None
is empty result of call to ghc-mod browse -d Data.List
You can check it with this commands:
import sublime_haskell_common as c
c.call_ghcmod_and_wait(['browse', '-d', 'Data.List'])
If it's empty, try to call ghc-mod in cmd/terminal: ghc-mod browse -d Data.List
Hmm, I found the reason.
My ghc-mod was outdated.
It cannot run ghc-mod browse -d Data.List
Fixed after update
Thank you for your help, again :)
Now that the cache file is filled, but it still takes about 40 seconds to load Sublime Haskell: loading standard modules info for cabal within 43.0495275434 seconds
Is it the correct behavior?
I've made commit to log time of cache-loading:
Sublime Haskell: loading standard modules cache for cabal within 6.37898108829 seconds
When plugin updates, you can check, how much time it takes to load cache.
~43 second is not normal, on my system it takes 2-3 seconds, so I haven't optimized it. I have system with same issue (~30 seconds), where I can test it. I'll create another issue for it
Sublime Haskell: loading standard modules cache for cabal within 6.60345688371 seconds
but why it still does this
Sublime Haskell: loading standard modules info for cabal
Sublime Haskell: loading standard modules info for cabal within 44.6623139267 seconds
It's ok. After last update (I've commited ~5 minutes ago) it will look like this:
Sublime Haskell: loading standard modules cache for cabal within 6.13843829297 seconds
...
Sublime Haskell: loading standard modules info for cabal
Sublime Haskell: loading standard modules info for cabal within 2.89315583762 seconds
Sublime doesn't load info with ghc-mod if cache exists, it just checks if it already loaded for every module. And it loads only new modules, that are not in cache. And in your case it takes 44 seconds. I think it's just not optimized (there may be many locks) and I've created issue #61 for it.
OK, thank you!
@princemaple, I described workaround in #61. It's not a solution, but will help.
@mvoidex Thank you!
Sublime Haskell: loading standard modules cache for cabal within 13.7681546678 seconds Sublime Haskell: loading standard modules info for cabal Sublime Haskell: loading standard modules info for cabal within 45.5319991898 seconds
Now ghc is 7.6.3
Any idea?
@princemaple, there is workaround described in #61 It's not fixed yet
@mvoidex Thanks. Do I lose anything for using this work around?
No, it just makes 'ghc-mod browse ModuleInGhcPackage' not to fail.
@mvoidex Cool, thank you very much.
no problem, feel free to ask anything :)
Sublime Haskell: loading standard modules info for cabal within 111.931780307 seconds
Is this supposed to happen every time Sublime starts?
I think there was once that Sublime Haskell can cache this, not loading for 100+ seconds every time. Now it doesn't? Or I remembered wrong?