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

Code structure follow up #428

Merged
merged 4 commits into from
Feb 13, 2025
Merged

Code structure follow up #428

merged 4 commits into from
Feb 13, 2025

Conversation

boocmp
Copy link
Collaborator

@boocmp boocmp commented Feb 11, 2025

This PR is easier to review commit by commit:

  1. AbstractNetworkFilter has been moved to a separate file to reduce the amount of code in network.rs.
  2. The code related to regular expressions has been moved from network.rs to regex_manager.rs (also reducing the amount of code). An iterator implementation has been added for the FilterPart enum, and the compile_regex function no longer directly depends on NetworkFilter. String cloning during regex compilation has been removed.
  3. The key type of the HashMap in RegexManager has been changed to u64 instead of *const NetworkFilter, reducing dependencies on NetworkFilter (a step toward the goal of completely removing this dependency).

@boocmp boocmp self-assigned this Feb 11, 2025
Copy link

@github-actions github-actions bot left a 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: 22dcb7e Previous: 98aa69f Ratio
rule-match-browserlike/brave-list 1703637164 ns/iter (± 25099454) 1717001323 ns/iter (± 16907239) 0.99
rule-match-first-request/brave-list 1008776 ns/iter (± 8193) 989900 ns/iter (± 15044) 1.02
blocker_new/brave-list 202647633 ns/iter (± 2484961) 202730589 ns/iter (± 4420888) 1.00
memory-usage/brave-list-initial 41409969 ns/iter (± 3) 41409969 ns/iter (± 3) 1
memory-usage/brave-list-after-1000-requests 44005995 ns/iter (± 3) 44005995 ns/iter (± 3) 1

This comment was automatically generated by workflow using github-action-benchmark.

// Check for options: option=value1|value2
let mut option_and_values = maybe_negated_option.splitn(2, '=');
let (option, value) = (
option_and_values.next().unwrap(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] expect or unwrap called in function returning a Result

Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result


Cc @thypon @kdenhartog

@boocmp boocmp merged commit 4d39298 into master Feb 13, 2025
8 checks passed
@boocmp boocmp deleted the code_structure_2 branch February 13, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants