brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.62k stars 2.29k forks source link

[Perf] 13.4% regression in system_health.memory_mobile/browser_processes:reported_by_chrome:allocated_objects_size at v1.66.20 #36984

Open atuchin-m opened 6 months ago

atuchin-m commented 6 months ago

Bot: Pixel 4 Alert information: Median of segment before: 78268875.5 Median of segment after: 88731501 Relative change: 13.4%

Revision range: https://github.com/brave/brave-core/compare/f059d55f6082b23ef003e2f3010ebe1ea50d5b54...6614caeef9b62aec8f4585fc26c81cef32cb18c9 No Griffin changes in the related time frame.

https://brave-perf-dashboard.appspot.com/report?sid=c7688566df05fe21a15e23f9257b808a3a95df36aa49a375a53f7009c1a49fb5&rev=18697

image
atuchin-m commented 6 months ago

The affected stories: example.com and search.brave.com The memory category: the browser process, malloc (browser_process:reported_by_chrome:malloc:allocated_objects_size) https://brave-perf-dashboard.appspot.com/report?sid=0b6b3e06a32c559e4fc6642a149a3e3e990203d0aa3a36d9ae430a4f7e79eda1&start_rev=18010&end_rev=18702

atuchin-m commented 6 months ago

There is minor chromium bump in the revision range, but chromium doesn't affected by the regression. Probably, it's another commit in the range.

atuchin-m commented 6 months ago

The most matching change in the range: https://github.com/brave/brave-core/pull/22681

atuchin-m commented 6 months ago

ShouldStartRequest() in https://github.com/brave/brave-core/pull/22681 could results in large memory allocations (the result of Rust regex instantiation).

In the PR we moved it out from if-statement, looks like we start to call it more often in some scenarios.

@antonok-edm @ShivanKaul Could you please check it?

atuchin-m commented 6 months ago

Also this PR affects:

  1. cpuTime: https://brave-perf-dashboard.appspot.com/report?sid=368ed6517f7f8e0dc03cbd87938ee515256357149ce49e4adb6afa6906aa5919&rev=18694
  2. rectsBasedSpeedIndex https://brave-perf-dashboard.appspot.com/report?sid=40be0e8e07e8de6638e88666c7646ec9f4377ef88f3f5bb08f268b9bd55ce790&rev=18628