Skip to content

Conversation

@atuchin-m
Copy link
Collaborator

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

For brave/brave-browser#50463

The PR optimizes the peak memory usage by 5%.
append() doesn't drop the capacity of vec, it just calls set_len(0)

@atuchin-m atuchin-m self-assigned this Oct 31, 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: bb4a771 Previous: 013f82a Ratio
rule-match-browserlike/brave-list 2347667449 ns/iter (± 20286775) 2415314808 ns/iter (± 32783519) 0.97
rule-match-first-request/brave-list 1115395 ns/iter (± 10519) 1136036 ns/iter (± 33574) 0.98
blocker_new/brave-list 187657044 ns/iter (± 1689084) 191587636 ns/iter (± 2413020) 0.98
blocker_new/brave-list-deserialize 27836768 ns/iter (± 904659) 30894729 ns/iter (± 761050) 0.90
memory-usage/brave-list-initial 10212224 ns/iter (± 3) 10212224 ns/iter (± 3) 1
memory-usage/brave-list-initial/max 64057431 ns/iter (± 3) 67489115 ns/iter (± 3) 0.95
memory-usage/brave-list-initial/alloc-count 1610823 ns/iter (± 3) 1610823 ns/iter (± 3) 1
memory-usage/brave-list-1000-requests 2666926 ns/iter (± 3) 2666926 ns/iter (± 3) 1
memory-usage/brave-list-1000-requests/alloc-count 71337 ns/iter (± 3) 71337 ns/iter (± 3) 1
url_cosmetic_resources/brave-list 198816 ns/iter (± 1282) 203591 ns/iter (± 1162) 0.98
cosmetic-class-id-match/brave-list 3353399 ns/iter (± 943854) 3406731 ns/iter (± 908867) 0.98

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

@atuchin-m atuchin-m marked this pull request as ready for review October 31, 2025 15:12
@atuchin-m atuchin-m requested a review from a team as a code owner October 31, 2025 15:12
@atuchin-m atuchin-m merged commit 671ee95 into master Oct 31, 2025
9 checks passed
@atuchin-m atuchin-m deleted the remove-append-usage branch October 31, 2025 19:44
@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.

3 participants