-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ByteMatch hashCode() to reduce transitions object count. (#199)
Add ByteMatch hashCode() to reduce transitions object count. It takes many hours to compute the machine complexity of this rule on a laptop: { "field1": [{ "numeric": ["<=", 120.0] }], "field2": [{ "numeric": [">", 300.0] }], "field3": [{ "numeric": ["=", 60.0] }], "field4": [{ "numeric": ["<", 60.0] }], "field5": [{ "numeric": ["<=", 60.0] }] } This is because numeric matchers are compiles as ranges for comparison. The ranges create a sequence of numbers that then get added into the byte machine however most of these transition to a small number of state. See `ByteMachine.addRangePattern` for more details. Given that the numbers are only transition to handful of end states, we should have been merging the transtion within `ByteMap.updateTransitions`. However the merge relies on transitions being comparable which isn't the case for ByteMap. After adding hashcode() and equals(), we are not able to dedupe and avoid creating duplicates. This offers nominal benefit in rule matching latency but has notable improvement for (1) rule addition / removal time, and (2) when comparing the machine size / complexity.
- Loading branch information
Showing
4 changed files
with
54 additions
and
4 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
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
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
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