ProtocolPav / everthorn.net

The code for the Everthorn.net website
https://everthorn.net
1 stars 0 forks source link

Improve Quest Creator Search #4

Closed ProtocolPav closed 3 weeks ago

ProtocolPav commented 4 weeks ago

Improve the search of the comboboxes in the Quest Creator. Either via binary search or something else. Most likely some sort of library :))

cakePhone commented 4 weeks ago

As per https://github.com/ProtocolPav/everthorn.net/commit/ec6bbfe52aa97f450dfcff22bf2f8881f5607cd7, performance is mostly good. Known bug for search stopped working.

Why?

The way search on Combobox works is that the CommandItem component renders itself when the condition in find is met. Why is this an issue? We have 1200+ items rendered out running the same check at the same time. That is of time complexity O^2 if every item searches linearly.

Possible fix

Rewrite to render CommandItem components as the field.value fuzzily matches the item. Not render them all at first. This must be an outside check/function that will return the items to render out

ProtocolPav commented 4 weeks ago

Something I saw that others have done and I will link this here is called virtualization. Essentially loads items as they are needed (in the scroll area)

The issue with this is it breaks searching. But the thing I linked here I haven't actually checked so maybe it works. Idk lmk

cakePhone commented 4 weeks ago

And that's exactly what I did on that pushed commit

Hence why I'm suggesting a fix for the whole new issue created by the fix for the previous issue

ProtocolPav commented 4 weeks ago

I've looked through the code and I believe this component has virtualization and searching built in. Just gotta test it

cakePhone commented 4 weeks ago

Yeah, looks like it. I'll be signing off for the night though. Will resume work soon.

ProtocolPav commented 4 weeks ago

Same here. Tomorrow I will continue work on the form and the latest API changes to be made

ProtocolPav commented 3 weeks ago

I started working on this today, but my time got cut short by some distractions and then I completely forgot 😂

The component here supports virtualisation and search. Will implement tonight.

cakePhone commented 3 weeks ago

Search is improved and working as intended, only caveat is the scrollbar but ScrollArea brings back all the performance issues. Will close this.