Skip to content

Conversation

atuchin-m
Copy link
Collaborator

@atuchin-m atuchin-m commented Sep 11, 2025

The PR supports decoding resources before storing it. This optimize memory usage of ResourceStorage by ~30%.

  • add a new ResourceImpl internal struct to store decoded resources
  • validate each resource during initial loading
  • support encoding a resource back to base64 when we need this (get_redirect_resource())

@atuchin-m atuchin-m self-assigned this Sep 11, 2025
@atuchin-m atuchin-m requested a review from a team as a code owner September 11, 2025 14:33
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: 7864b74 Previous: dc5ab3c Ratio
rule-match-browserlike/brave-list 2241563378 ns/iter (± 11411310) 2257715931 ns/iter (± 10970298) 0.99
rule-match-first-request/brave-list 1033504 ns/iter (± 8329) 1027898 ns/iter (± 7402) 1.01
blocker_new/brave-list 153195531 ns/iter (± 1618122) 160723930 ns/iter (± 937821) 0.95
blocker_new/brave-list-deserialize 64567666 ns/iter (± 833904) 69177062 ns/iter (± 1097554) 0.93
memory-usage/brave-list-initial 18344519 ns/iter (± 3) 18858505 ns/iter (± 3) 0.97
memory-usage/brave-list-initial/max 66961309 ns/iter (± 3) 66961309 ns/iter (± 3) 1
memory-usage/brave-list-initial/alloc-count 1616130 ns/iter (± 3) 1616130 ns/iter (± 3) 1
memory-usage/brave-list-1000-requests 2551938 ns/iter (± 3) 2551938 ns/iter (± 3) 1
memory-usage/brave-list-1000-requests/alloc-count 68864 ns/iter (± 3) 68835 ns/iter (± 3) 1.00
url_cosmetic_resources/brave-list 203095 ns/iter (± 2033) 208414 ns/iter (± 1653) 0.97
cosmetic-class-id-match/brave-list 4334884 ns/iter (± 1183117) 4317439 ns/iter (± 1187009) 1.00

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

@atuchin-m atuchin-m force-pushed the optimize-resource-storage-memory branch from 0e01724 to 6acaa5a Compare September 12, 2025 11:51
@atuchin-m atuchin-m force-pushed the optimize-resource-storage-memory branch from 6acaa5a to 345e1d7 Compare September 12, 2025 11:58
@antonok-edm antonok-edm merged commit 94afb5e into master Sep 12, 2025
9 checks passed
@antonok-edm antonok-edm deleted the optimize-resource-storage-memory branch September 12, 2025 20:57
atuchin-m added a commit to brave/brave-core that referenced this pull request Sep 17, 2025
The adblock-rust changes to publish: brave/adblock-rust#517
This should partially address the perf issue related to the resource memory usage.
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.

3 participants