New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter out keys when processing objects #1489
Comments
@jkeiser Marking for 1.0 though it could be 0.9. It is not hard to implement. It just requires benchmarking. |
Note that this could be extended to handle escaped content (backslashes), maybe optionally. |
It seems like this might also play nicely with multi-field lookup interface ("find field x, y or z, whatever comes next"). |
@jkeiser Right. So I imagine a template where you pass a "matcher" which returns true if and only if the string matches. The idea is to do more work upfront building a matching instance. Ultimately, you could do regex!!! |
The idea is to very quickly dismiss keys that are not a match when searching through an object.
Suppose that the target has at least 7 bytes.
Pick up a 64-bit word. Copy up to 8 characters from the target to the this 64-bit word, terminating with a quote if possible. Let us call this word FILTER.
Go through the keys. Load a 64-bit word (always safe because of padding) at that location. Do an XOR with FILTER. You get zero if and only if the first 8 characters match (including possible the quote). If so, investigate further, if not move on.
If the target has fewer than 7 bytes, then you need to use a mask, but there are only 7 cases so you can use a lookup table or some other cleverness.
See #1485
The text was updated successfully, but these errors were encountered: