bhoogle
bhoogle copied to clipboard
Lags while typing
(I love bhoogle!)
While the UI is very fast (i.e. once data is listed, browsing it is just instantaneous), typing text in Type
produces lags of a couple of seconds.
In the following screencast, I'm typing Data.List
without pauses: notice please the delay with which List
is displayed.
https://user-images.githubusercontent.com/150719/222354749-288ca993-9782-4db1-89a8-240a6a962ee8.mp4
I noticed that also hitting tab for moving from Type
to Text
renders after 1'.
I installed bhoogle via cabal install bhoogle
with the following setup
ghcup list --show-criteria=installed
Tool Version Tags Notes
✔✔ ghc 9.2.5 recommended,base-4.16.4.0 hls-powered
✓ ghc 9.4.3 base-4.17.0.0
✓ ghc 9.4.4 latest,base-4.17.0.0 hls-powered
✓ cabal 3.6.2.0 recommended
✔✔ cabal 3.8.1.0 latest
✔✔ hls 1.9.1.0 latest
✔✔ ghcup 0.1.19.2 latest,recommended
Hi,
I'm glad you like bhoogle. It was written just as an example of a simple brick app, so its great that its actually useful by accident :)
The slow down is almost certainly because of the synchronous calls to searchDatabase
(from searchHoogle). This is called by doSearch which is called in the handleEvent event handler each time a key is pressed.
Making that any smarter would probably undermine the purpose of it being a simple example brick app. I'd imagine a simple fix would be to wait some short period between keystrokes before searching, i.e. to wait until it was likely that the user had stopped typing. This would probably best be done by sending messages to a channel and having a separate thread deciding when to search.
For now I'm unlikely to add that, perhaps one day, or from a PR :P
Thanks for the feedback though, I'll keep this open just in case