
Fast search, filter & sort for large client-side collections in JavaScript
Hey everyone! I'd like to share an npm package I built for working with large collections of 100K+ items on the client side. The problem Sometimes the server sends back a huge array 100K+ items. And you need search, filter, and sort on the client side. The issue is that standard JS methods like .filter() or .sort() go through the whole array every time. On small data it's fine, but on large arrays the UI starts to feel slow. What this package does It has three parts, and you can use each one separately or all together: TextSearchEngine — text search. Builds an index once, then searches through it instead of scanning the full array every time. FilterEngine — filtering by one or more fields. Indexed fields are looked up directly without going through the whole array. SortEngine — sorting. For a single field it uses a pre-built index, for multiple fields it falls back to a regular sort. The key idea: the index is built once when you pass in the data. After that, every search, filter, or s
Continue reading on Dev.to React
Opens in a new tab



