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 #3. #434

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Code structure follow up #3. #434

wants to merge 4 commits into from

Conversation

boocmp
Copy link
Collaborator

@boocmp boocmp commented Feb 20, 2025

Bench performance has been improved a little.
check, check_all functions are simplified.

@boocmp boocmp self-assigned this Feb 20, 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: 29f787f Previous: 0fe3582 Ratio
rule-match-browserlike/brave-list 1697628006 ns/iter (± 23321845) 1839697309 ns/iter (± 11629260) 0.92
rule-match-first-request/brave-list 1002491 ns/iter (± 20533) 1015644 ns/iter (± 10433) 0.99
blocker_new/brave-list 215643394 ns/iter (± 6381520) 209824147 ns/iter (± 3193249) 1.03
memory-usage/brave-list-initial 41408849 ns/iter (± 3) 41409969 ns/iter (± 3) 1.00
memory-usage/brave-list-after-1000-requests 44004875 ns/iter (± 3) 44005995 ns/iter (± 3) 1.00

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

@boocmp boocmp requested a review from ShivanKaul February 20, 2025 03:38
README.md Outdated
Comment on lines 57 to 58
The `unsync-regex-caching` feature enable optimizations for rule matching speed and the amount of memory used by the engine.
These features can be disabled to make the engine `Send + Sync`, although it is recommended to only access the engine on a single thread to maintain optimal performance.
Copy link
Collaborator

Choose a reason for hiding this comment

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

doc here should be updated to refer to the feature singularly (i.e. enable -> enables, These features -> This feature)

src/request.rs Outdated
@@ -98,15 +100,25 @@ impl Request {
if case_sensitive {
Cow::Borrowed(&self.url)
} else {
Cow::Owned(self.url.to_ascii_lowercase())
Cow::Borrowed(&self.url_lower_cased)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can just return &str directly instead of Cow if it's borrowed in all cases

src/request.rs Outdated
Comment on lines 109 to 111
) -> std::iter::Chain<
core::iter::Flatten<std::option::IntoIter<&Vec<utils::Hash>>>,
std::slice::Iter<'_, utils::Hash>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

return type of impl Iterator<Item=&utils::Hash> would be cleaner here

src/request.rs Outdated
pub hostname: String,
pub request_tokens: Vec<utils::Hash>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's make these new fields pub(crate), they're an internal implementation detail and we don't want them to be set outside of the constructors

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.

2 participants