Question: Does the regex-syntax crate optimize its HIR? #915
-
BackgroundI'm working on writing yet another fuzzing framework (YAFF for short), but I'm doing it via an interesting twist. I'm using regular expressions (specifically, what
The IssueFuzzing rarely produces truly optimal output, and part of that problem is that it can generate regular expressions that are horribly inefficient. E.g., alternations that repeatedly sample the same region of byte string space, or have partitioned space into a billion small points which could all be joined into a much larger combined space. I want to know the following:
Ideally for me, the answer to both questions would be 'yes.' That way I can mutate to my heart's content, but still have a way of reducing the regular expression down to the smallest subspace that a) contains valid instances only, and b) still causes a test failure. I hope all of this makes sense. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It does a little bit of optimization today. But very little. Here's one example: regex/regex-syntax/src/hir/mod.rs Lines 398 to 402 in 4075d39 I do have a rather large WIP patchset (that will become regex/regex-syntax/src/hir/mod.rs Lines 342 to 405 in 7ecd9ff Example 2: regex/regex-syntax/src/hir/mod.rs Lines 410 to 460 in 7ecd9ff But... It looks like you're asking about particular optimizations. For example:
I actually need to see examples of this to be honest. I bet I could make a good guess at what you're saying. I would say that There are other complexities. For example, So I think in order to really consider your question, it would be best to provide specifics. :-)
Can you show me your code that mutates an |
Beta Was this translation helpful? Give feedback.
It does a little bit of optimization today. But very little. Here's one example:
regex/regex-syntax/src/hir/mod.rs
Lines 398 to 402 in 4075d39
I do have a rather large WIP patchset (that will become
regex-syntax 0.8
at some point) that beefs up the optimizations. Example 1:regex/regex-syntax/src/hir/mod.rs
Lines 342 to 405 in 7ecd9ff