event-ruler icon indicating copy to clipboard operation
event-ruler copied to clipboard

Simplify anything-but

Open timbray opened this issue 3 years ago • 2 comments

What is your idea?

The redesign of ByteMachine that came in with wildcards can efficiently represent byte-range transitions. Given that, anything-but and anything-but-prefix can be directly represented in a ByteMachine straightforwardly and efficiently, which would simplify the rule-matching code path.

Would you be willing to make the change?

Maybe

timbray avatar Sep 04 '22 18:09 timbray

@timbray Do you still see this as an opportunity? The anything-but-prefix (and my proposal for anything-but-suffix) matching seems to simply take advantage of the StateMachine transitions (https://github.com/aws/event-ruler/blob/84120a946f1a231a0c670d49ded7dff140d014f3/src/main/software/amazon/event/ruler/ByteMachine.java#L459-L503), and if they match the get tagged as failed.

schenksj avatar Jan 29 '23 18:01 schenksj

Absolutely. The way anything-but and suffix matching is done are sort of hacky (I can say that because anything-but is my own gross hack) and I suspect quite a bit of code could be discarded if someone were willing to buckle down and replace the hacks with principled automaton-building. I'm pretty sure performance would improve too.

timbray avatar Jan 29 '23 18:01 timbray