Use RapidFuzz for server-side fuzzy search#5827
Closed
evnchn wants to merge 3 commits intozauberzeug:mainfrom
Closed
Use RapidFuzz for server-side fuzzy search#5827evnchn wants to merge 3 commits intozauberzeug:mainfrom
evnchn wants to merge 3 commits intozauberzeug:mainfrom
Conversation
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
Btw each call to rapidfuzz takes 1ms, no need |
Collaborator
Author
|
Actually got one more commit at https://github.com/evnchn/nicegui/tree/expt/truncated-search-results which could further mimimize the time (reduce what is being sent, dodge But not sure whether server-side fuzzy search is adopted in the end so I'm leaving it here for now. |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
Google SEO favors INP. The Core Web Vitals testing platform is opaque but it appears that CPU is slow, Network is slow.
https://pagespeed.web.dev/analysis/https-nicegui-io/li5rniz6jo?hl=en_GB&form_factor=mobile
Implementation
Can we move the search load to the server-side? Yes we can.
website/static/fuse.js@7.0.0and all referencesrapidfuzzwindow_stateto probe form-factor without round-tripawait asyncio.sleep(0.2) # debouncewhich works because If a third task with the same name is created while the first one is still running, the second one is discarded.End effects:
Considering that our mean latency across fly.io is 15ms circa (if Claude is to be trusted), and INP for desktop is 71ms, I think that 4x 15ms (up down up down) + 11ms (CPU) network time is the likely current status.
Then INP for desktop after this PR could hit 41ms, and by proportional scaling INP for mobile could hit 107ms which would be a huge win.
Progress
Final notes
IMO search results actually improved. There are people saying fuse.js isn't the best, and I guess I would agree based on our thing which we are searching through. Ref: https://www.reddit.com/r/nextjs/comments/10yxu92/what_is_your_go_to_clientside_fuzzy_searching/
Less shallow than #5824. Can be adopted together.
Are we ready for the additional CPU load which is needed to sustain the search?