underscore-query icon indicating copy to clipboard operation
underscore-query copied to clipboard

Data Indexes

Open megawac opened this issue 8 years ago • 1 comments

Something like this probably makes more sense on a library like Backbone query with more granular control of the data structure (BB model). However I'm curious @davidgtonge about your opinion on the possibly supporting built indexes.

megawac avatar May 17 '16 19:05 megawac

Yeah - I implemented something like this in backbone query. I'm doing a lot more functional stuff now, so my preference is to use memoization.

Here is some WIP code to add memoized filtering and sorting for arrays: https://github.com/davidgtonge/query-predicate/blob/master/src/utils/sort.js

Essentially you prime the cache by running a load of queries - you can then filter the array using a combination of queries - and the performance should be really good.

I'm putting together a proof of concept using data from the Land Registry (hundreds of thousands of records).

davidgtonge avatar May 17 '16 20:05 davidgtonge