Skip to content
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

Regex tools & benchmark rename #290

Merged
merged 3 commits into from
May 21, 2024
Merged

Regex tools & benchmark rename #290

merged 3 commits into from
May 21, 2024

Conversation

Anilm3
Copy link
Collaborator

@Anilm3 Anilm3 commented May 1, 2024

This PR introduces two small tools:

  • simplify_regex: takes a regex as an input and returns the "simplified" regex generated by re2.
  • simplify_ruleset: currently takes a ruleset in json format as an input and replaces all regexes by their "simplified" version"

Simplified regexes aren't necessarily simpler, in fact they tend to be longer. However, since these regexes more closely mirror the internal representation of RE2, they should reduce regex compilation time, although in my tests this represented only represented a 1.5% improvement on the whole ruleset.

More interestingly, the simplified regex can be used to better understand what a regex is doing, as the simplified version tends to be more readable.

This PR also renames the benchmark cmake target from benchmark to waf_benchmark as it causes a conflict with the google benchmark library. As a consequence, the benchmark job is expected to fail, it'll work fine after the merge.

@codecov-commenter
Copy link

codecov-commenter commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.93%. Comparing base (aee070e) to head (9c46b0b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #290   +/-   ##
=======================================
  Coverage   83.93%   83.93%           
=======================================
  Files         127      127           
  Lines        5807     5807           
  Branches     2796     2796           
=======================================
  Hits         4874     4874           
  Misses        353      353           
  Partials      580      580           
Flag Coverage Δ
waf_test 83.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pr-commenter
Copy link

pr-commenter bot commented May 1, 2024

Benchmarks

Benchmark execution time: 2024-05-01 14:19:04

Comparing candidate commit 818eddf in PR branch anilm3/regex-tools with baseline commit 48c6909 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 19 metrics, 0 unstable metrics.

@Anilm3 Anilm3 changed the title Regex tools Regex tools & benchmark rename May 21, 2024
@Anilm3 Anilm3 marked this pull request as ready for review May 21, 2024 08:28
@Anilm3 Anilm3 requested a review from a team as a code owner May 21, 2024 08:28
@Anilm3 Anilm3 merged commit 6f6bb70 into master May 21, 2024
42 of 43 checks passed
@Anilm3 Anilm3 deleted the anilm3/regex-tools branch May 21, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants