Skip to content

Conversation

@atuchin-m
Copy link
Collaborator

@atuchin-m atuchin-m commented Oct 24, 2025

For brave/brave-browser#50463

The PR improves memory usage and building time:

  • deduplicates some strings, that saves memory and building time ;
  • optimizes encode_script_with_permission by preallocate the necessary memory.

The results:

  • memory 11.5MB => 10.2MB
  • building time 183.06 ms => 170.23 ms

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: 6d3fef0 Previous: 1bf068d Ratio
rule-match-browserlike/brave-list 2247328681 ns/iter (± 11044224) 2260065342 ns/iter (± 8732867) 0.99
rule-match-first-request/brave-list 1104350 ns/iter (± 5584) 1127532 ns/iter (± 14737) 0.98
blocker_new/brave-list 177390045 ns/iter (± 2969458) 178507782 ns/iter (± 1633867) 0.99
blocker_new/brave-list-deserialize 23340661 ns/iter (± 181967) 23438268 ns/iter (± 45267) 1.00
memory-usage/brave-list-initial 10212240 ns/iter (± 3) 11499344 ns/iter (± 3) 0.89
memory-usage/brave-list-initial/max 67489131 ns/iter (± 3) 67489115 ns/iter (± 3) 1.00
memory-usage/brave-list-initial/alloc-count 1610839 ns/iter (± 3) 1660477 ns/iter (± 3) 0.97
memory-usage/brave-list-1000-requests 2666942 ns/iter (± 3) 2666926 ns/iter (± 3) 1.00
memory-usage/brave-list-1000-requests/alloc-count 71353 ns/iter (± 3) 71337 ns/iter (± 3) 1.00
url_cosmetic_resources/brave-list 202523 ns/iter (± 806) 200630 ns/iter (± 2466) 1.01
cosmetic-class-id-match/brave-list 3553534 ns/iter (± 999457) 3420999 ns/iter (± 962032) 1.04

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

@atuchin-m atuchin-m force-pushed the optimize-ruleset-building branch from a94b228 to b3f4f42 Compare October 24, 2025 21:00
@atuchin-m atuchin-m self-assigned this Oct 24, 2025
@atuchin-m atuchin-m force-pushed the optimize-ruleset-building branch from b3f4f42 to 4b59d73 Compare October 30, 2025 19:37
@atuchin-m atuchin-m force-pushed the optimize-ruleset-building branch from 4b59d73 to 6d3fef0 Compare October 30, 2025 19:38
@atuchin-m atuchin-m marked this pull request as ready for review October 30, 2025 20:02
@atuchin-m atuchin-m requested a review from a team as a code owner October 30, 2025 20:02
@boocmp boocmp merged commit 013f82a into master Oct 31, 2025
9 checks passed
@boocmp boocmp deleted the optimize-ruleset-building branch October 31, 2025 04:30
atuchin-m pushed a commit that referenced this pull request Oct 31, 2025
@atuchin-m atuchin-m added the perf label Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants