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
Recognize certain Junos AS Path regexes and convert them to VI construct #8770
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @samarthdhingra)
projects/batfish/src/test/java/org/batfish/representation/juniper/AsPathMatchExprParserTest.java
line 97 at r1 (raw file):
@Test public void testAsPathMatchRegexFallback() { for (String regex : new String[]{"1234", "1234?", "1234{0,1}", "12{1,4} 34", "[123-125]", "123 (56 | 78)?", "()"}) {
this pattern would be good to optimize
Code quote:
"[123-125]",
Done.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @samarthdhingra)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you measured how much this speeds up parsing configs with these patterns, and how much its slow down parsing configs without them?
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @samarthdhingra)
Depending on the as-path regex pattern, I observe most execution time improvement if the junos regex contains range pattern .* start-end .* or .* [start-end] .* (depending on the different between the ranges). For the sample config tested using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @samarthdhingra)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @samarthdhingra)
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #8770 +/- ##
=======================================
Coverage 72.32% 72.32%
=======================================
Files 3288 3289 +1
Lines 168552 168612 +60
Branches 19755 19764 +9
=======================================
+ Hits 121907 121956 +49
- Misses 37552 37561 +9
- Partials 9093 9095 +2
|
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @samarthdhingra)
Performance optimization for some of Junos AS path regex patterns by converting them to existing VI construct
AsSetsMatchingRanges
. This bypasses converting these junos specific regular expression to java regular expression.Following Junos AS Path regex patterns are included :
If one of the above patterns don't match, then fallback to the existing solution of converting to java regex using
AsPathRegex
As part of testing using
bf_session.init_snapshot_from_text(..)
for a single device config with multiple range pattern regexes, snapshot initialization time decreased from~155s
to~3s
.