Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Search Optimization / Progressbar #1830

Closed
metal450 opened this issue Oct 16, 2021 · 4 comments
Closed

Global Search Optimization / Progressbar #1830

metal450 opened this issue Oct 16, 2021 · 4 comments

Comments

@metal450
Copy link
Contributor

When searching for something globally, CherryTree actually iterates through all the nodes, opening & rendering each, while looking through the text. This can be pretty slow in some cases.

It seems like this could be sped up significantly by avoiding all the UI updates/renders: simply show a progressbar, & do the searching in the background. That would skip all the extra processing of actually expanding the nodes in the tree, moving the cursor, opening each node, rendering all the content, etc.

In addition, a progressbar would be quite a bit clearer, as currently, it's not possible to tell how far through the search one is. Even if it's just an estimate, pre-counting the nodes & showing a %, while keeping the rest of the UI stable, would give a much better impression of how much progress has been made.

@metal450 metal450 changed the title Global Search Optimization Global Search Optimization / Progressbar Oct 16, 2021
@poleguy
Copy link
Contributor

poleguy commented Sep 1, 2023

I would support this change. I looked into the code that does this, but it wasn't clear to me how to iterate through the nodes without rendering, so I didn't attempt to fix it myself.

There is also a real risk of making an accidental edit in a node, as all of the nodes are editable when they are being opened and rendered. It bit me. I accidentally selected and deleted some text in a node while the search was running and it was very difficult to know what I had done because it immediately jumped to another node after I accidentally selected/typed into the window. In addition, since undo is per node, I couldn't just hit ctrl-z to undo, I would have had to hove found the unknown edited node first and then hit undo.

@giuspen
Copy link
Owner

giuspen commented Sep 16, 2023

I improved significantly the speed of the search/replace with the option 'all matches' (default) avoiding to do the rendering every time a match is found, as also advised in this ticket. This will be available in the next version 1.0.2 or 1.1.0.

@giuspen giuspen closed this as completed Sep 16, 2023
@poleguy
Copy link
Contributor

poleguy commented Sep 16, 2023

Thanks! I'll test this Monday. I'll review this code to hopefully learn how you did it, as it wasn't clear to me how to decouple the rendering.

@metal450
Copy link
Contributor Author

Still missing a progressbar though - when I perform a search it actually appears to do nothing for awhile (it's not clear that it's searching), & then suddenly the results pop up. The first time I did this I actually didn't think the search worked, so I did it again, and then 2x results popped up. Need some sort of progressbar/indicator that a search is in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants