What is the maximum array count for this sorter to perform well?
mech opened this issue · comments
match-sorter
version: 6.3.1node
version: 14.17.0
Relevant code or config
// With 500K items of 17MB file is slow
matchSorter(items, inputValue);
// Using this is fast
items.filter(item => item.toLowerCase().includes(inputValue.toLowerCase()))
What you did:
Do a simple item search.
What happened:
Was expecting performance to be somewhat still ok compare to basic CONTAINS method.
What is the ideal maximum array count before the sorting become very laggy and are there any optimization we can make ourselves?
Hi @mech,
You'll have to do your own testing. I had 16k items to search through once and needed to put it into a web worker (both the items and match-sorter) to make the app responsive when searching. That worked pretty well.
Unfortunately there's nothing actionable in this issue so I'm going to close it. Good luck!
You'll have to do your own testing. I had 16k items to search through once and needed to put it into a web worker (both the items and match-sorter) to make the app responsive when searching. That worked pretty well.
Can you provide an example of how to do that? I have 7K items and need to do something about performance. Thank you!
I used a webpack loader called workerize. https://github.com/kentcdodds/react-performance/blob/main/src/workerized-filter-cities.js