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

Trie Data Structure for Search Completion #302

Open
KevinTyrrell opened this issue Sep 10, 2020 · 5 comments
Open

Trie Data Structure for Search Completion #302

KevinTyrrell opened this issue Sep 10, 2020 · 5 comments

Comments

@KevinTyrrell
Copy link

KevinTyrrell commented Sep 10, 2020

While talking in Discord, I would hit my Push-To-Talk keybind j while having the Aux window open. The resulting spam of jjjjjjjjjjjjjjjjjjjjjjjjjj causes Aux to continuously search for items of the name j, then jj, jjj, etc. My WoW client then freezes for ~8 seconds due to the sheer number of Aux operations being performed. However once jj is typed in, Aux should now know that there is no item named jj in the database of item names. Thus auto completion should cease. The way to implement this behavior is a Trie data structure, which is commonly used for text prediction for messaging apps, prefix+suffix searches, etc.

Each node of the Trie contains a table which associates letters -> another Trie node. Every item in the game is fed through into the Trie letter by letter. The table itself can be saved to the hard drive so that this process only needs to take place once per install.

@shirsig
Copy link
Owner

shirsig commented Oct 17, 2020

Thanks for the suggestion but with normal typing it's fast enough and this is too much work for such a corner case as holding down a key. Perhaps if I'm really bored sometime.

@KevinTyrrell
Copy link
Author

Understandable. I must ask though:r in normal use of Aux do you ever have mini-stuttering/screen freezes while typing in the search bar? They last only ~200ms but after using it for an entire year its hard to ignore.

@shirsig
Copy link
Owner

shirsig commented Dec 13, 2020

I found a bug that was causing duplicates to be added to the autocomplete list, that's how it got so slow. The bug is fixed now but you still have to run /aux clear item cache and /run ReloadUI()

@KevinTyrrell
Copy link
Author

Well done, appreciate the follow-up.

@KevinTyrrell
Copy link
Author

@shirsig

Here's a video demonstration. https://streamable.com/b7uzx2

0:25 -> 1:32: Typed random characters which caused a minute long client freeze.

1:48: Item Cache clear

2:30 Ran into some weird behavior with item caching. I would have thought that searching the item would insert it into the autocomplete cache. Let me know if that is expected behavior.

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

2 participants