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

Fix CodeEdit completion being very slow in certain cases #80472

Conversation

ajreckof
Copy link
Member

@ajreckof ajreckof commented Aug 10, 2023

Fixes #80041

Okay so it is not really freezing it is just taking way way way way way way too long. What is actually happening is that it is trying to find all possible way to match the query inside way too long options. Just to give an idea of how bad this becomes here the query is around 40 characters long and options are often 200-300 long. which means at some steps it can go up to 10000000 matches which slow down the whole process. With that said I have a quick and easy fix that do make it quicker not really perfect but still usable it uses an altered version that gives more precedence to grouped by not looking further if the next character matches. Beware that this means the altered algorithm will take the first c in "MaincartoonCanvas" even for a queryy like "MainCanvas", this obviously mean it will rank differently option that show this behaviour . This is the worst case I could think of.

I made a quick PR there it runs smoothly even with OP really astronomical example (around a hundred or even more options with a size of around 300 for some).
#80041 (comment)

I also added some rename that were not properly done during the previous PR.

@ajreckof ajreckof requested a review from a team as a code owner August 10, 2023 05:55
@Calinou Calinou added bug topic:gui performance cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release labels Aug 10, 2023
@Calinou Calinou added this to the 4.2 milestone Aug 10, 2023
@Calinou
Copy link
Member

Calinou commented Aug 10, 2023

I suggest changing the commit message to mention CodeEdit by name:

Fix CodeEdit completion being very slow in certain cases

@ajreckof ajreckof force-pushed the Fix-slowliness-of-autocompletion-on-nodepath branch from aed28e6 to 1eb3d99 Compare August 10, 2023 06:15
@akien-mga akien-mga changed the title Fix slowliness on extreme cases Fix CodeEdit completion being very slow in certain cases Aug 10, 2023
@akien-mga akien-mga merged commit 850b9b1 into godotengine:master Aug 10, 2023
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Sep 21, 2023
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.2.

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

Successfully merging this pull request may close these issues.

The engine crashes after changing the path to the node
4 participants