-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(gatsby): Support
lte
for indexed fast filters (#22932)
* Rename function to better fit what it returns * Use `filterCacheKey` more consistently * Consistency around `nodesPerValue` * Fix the name and typing of array of sets of nodes * Fix typing, fix perf bug The typing of the array of caches was incorrect (see previous commit too). The sort, affected in this commit, was sorting by `.length`, but the value is a `Set` so the intention was to sort by `.size` since its `.length` will always be `undefined`. This won't change semantics, just meant that the sort didn't do anything, leading to a sub-optimal performance. * Extend the `FilterCache` type to support op-specific meta data * Replace wild usage of `FilterType` * Refactor some old comments / naming to be consistent with current code / types * Suggested changes Followup commits suggested by @vladar in #22742 * Enable `lte` for fast filters * Mandatory lint/type fix commit * And the loki commit * Enable/disable query and eleeMatch ops in one place * Fix tests, fix lte binary search lookup * Support `null` properly and handle not found binary search case The binary search should not return an arbitrary node, but rather a signal value (`undefined` in this case) that it failed somehow. It shouldn't, but who knows. The `null` case was a bit more work because it affects typign and all kinds of weird comparing edge cases. There's also a distinction between how `eq` treats `null` target values versus how `lte` treats them. So I had to encode them differently in the cache. Hence the type update. * Sigh, this is why I had to introduce that type in the first place * Forgot to remove an argument from followup work * Apply suggestions
- Loading branch information
Showing
5 changed files
with
439 additions
and
141 deletions.
There are no files selected for viewing
This file contains 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
Oops, something went wrong.