-
Notifications
You must be signed in to change notification settings - Fork 176
Don't use old method in tests #560
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
base: master
Are you sure you want to change the base?
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.
Rust Benchmark
| Benchmark suite | Current: 9102886 | Previous: e9299eb | Ratio |
|---|---|---|---|
rule-match-browserlike/brave-list |
1778782824 ns/iter (± 2335270) |
1972094868 ns/iter (± 5118480) |
0.90 |
rule-match-first-request/brave-list |
1125346 ns/iter (± 5335) |
1114948 ns/iter (± 7936) |
1.01 |
blocker_new/brave-list |
152508811 ns/iter (± 1250572) |
149920984 ns/iter (± 359157) |
1.02 |
blocker_new/brave-list-deserialize |
20873957 ns/iter (± 116935) |
26447852 ns/iter (± 105485) |
0.79 |
memory-usage/brave-list-initial |
10212216 ns/iter (± 3) |
10212216 ns/iter (± 3) |
1 |
memory-usage/brave-list-initial/max |
63149135 ns/iter (± 3) |
63149135 ns/iter (± 3) |
1 |
memory-usage/brave-list-initial/alloc-count |
1231721 ns/iter (± 3) |
1231721 ns/iter (± 3) |
1 |
memory-usage/brave-list-1000-requests |
2645922 ns/iter (± 3) |
2645938 ns/iter (± 3) |
1.00 |
memory-usage/brave-list-1000-requests/alloc-count |
70984 ns/iter (± 3) |
71016 ns/iter (± 3) |
1.00 |
url_cosmetic_resources/brave-list |
186713 ns/iter (± 553) |
189954 ns/iter (± 1211) |
0.98 |
cosmetic-class-id-match/brave-list |
3502960 ns/iter (± 935804) |
3389120 ns/iter (± 946890) |
1.03 |
This comment was automatically generated by workflow using github-action-benchmark.
| .compiled_regex_count, | ||
| 0 | ||
| ); | ||
| // Regex can't be compiled, so no match. |
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.
the test case added here (already in the disabled state):
40b7815
regex crate can't parse such regex, so I changed the test to verify it doesn't match
1c5c5ec to
fceebb0
Compare
fceebb0 to
9102886
Compare
| #[doc(hidden)] | ||
| pub(crate) fn check_exceptions(&self, request: &Request) -> bool { |
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.
no need to include #[doc(hidden)] on pub(crate) items
| } | ||
|
|
||
| #[doc(hidden)] | ||
| pub fn matches_test(&self, request: &request::Request) -> bool { |
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.
#[cfg(test)]?
| let mut regex_manager = RegexManager::default(); | ||
| regex_manager.update_time(); | ||
| let engine = make_engine("||geo*.hltv.org^"); | ||
| engine.borrow_regex_manager(); |
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.
comment would also be useful here to explain why the extra borrows are necessary
| #[cfg(test)] | ||
| pub fn borrow_regex_manager(&self) -> crate::blocker::RegexManagerRef<'_> { |
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.
comment describing why this is necessary would be helpful
(I can tell from the diffs below, but later it won't be as obvious)
| impl NetworkMatchable for NetworkFilter { | ||
| fn matches(&self, request: &request::Request, regex_manager: &mut RegexManager) -> bool { |
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.
fwiw, this is a breaking API change and will require another bump up to 0.12.x
The PR removes
impl NetworkMatchable for NetworkFilterand port the related tests to the flatbuffer impl (that we actually use in production)