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

[perf, epic] Investigate the startup performance #33724

Open
atuchin-m opened this issue Oct 18, 2023 · 12 comments
Open

[perf, epic] Investigate the startup performance #33724

atuchin-m opened this issue Oct 18, 2023 · 12 comments
Assignees
Labels
OS/Android Fixes related to Android browser functionality OS/Desktop perf QA/No release-notes/exclude
Projects

Comments

@atuchin-m
Copy link
Contributor

The perf tests (system_health.common_health) shows that we use much more CPU during the startup.
Mac x64, cr117: Chrome 909.155ms, Brave: 2,160ms, Brave-no-adblock: 1,368ms
That could have a visible impact on user experience (especially on Android, when app restart is a usual thing)

The goals are:

  • find the main contributors into the difference;
  • create issues, discuss and optimize or help to optimize;
  • setup more precise instruments to track startup performance and to prevent future degradation .

This is meta issue to link all the related work.

@atuchin-m atuchin-m added QA/No perf release-notes/exclude OS/Android Fixes related to Android browser functionality OS/Desktop labels Oct 18, 2023
@atuchin-m atuchin-m self-assigned this Oct 18, 2023
@atuchin-m
Copy link
Contributor Author

atuchin-m commented Oct 18, 2023

Some related work:

  1. CPU usage perf test (startup is included): Perf: enable system_health.common_desktop to perf CI and update WPRs  #30969
  2. loading.desktop.brave.startup perf test to see page loading timing just after the startup: Add a perf test to measure startup page loading timings #33651

@atuchin-m
Copy link
Contributor Author

system_health.common_health shows that 95% of CPU is taken by the browser process (both Brave & Chrome).
So the browser process looks like a primary target to focus on.

One important thing to check: do we correctly count CPU usage of short-living processes (like DataDecoder) that are ended to the moment we end the perf test?

@atuchin-m
Copy link
Contributor Author

The result of CPU profiling of first 6 sec of browser process (Static local build, win-10, high-perf pc, VS studio profiler):
Total: 2914ms

Adblock:
783 Adblock lists parsing
30 OnDATLoaded
17 AdBlockFiltersProviderManager::FinishCombinating

Greaselion:
108 ConvertGreaselionRuleToExtensionOnTaskRunner
29 DeleteExtensionDirs

Wallet:
201 JSON data decoding callback, wallet/IPFS

HTTPS Everywhere:
182 Various SQLlite work

Chromium heavy stuff:
281 Safebrowsing (SHA256 database verification)
126 IsJoinedToAzureAD (check policy things?)
107 Session Restore

adblock-parsing-work adblock-finish-combinating greaselion JSON-work-wallet http-everywhere

@atuchin-m
Copy link
Contributor Author

About short-living processes:
we have about 7 instances of DataDecoderService during startup. They are likely to do (Wallet feature?) some JSON parsing work and it seems takes ~20-30ms per process (need to check)

Screenshot 2023-10-18 at 19 30 19 Screenshot 2023-10-18 at 19 27 15

@atuchin-m
Copy link
Contributor Author

Related adblock work:
#33718
#33532

@atuchin-m
Copy link
Contributor Author

DataDecoder issue: #30940

@atuchin-m
Copy link
Contributor Author

Wallet startup performance (in case no created wallet): #33757

@atuchin-m
Copy link
Contributor Author

other Wallet perf work:
#33758
#33759
#33760

@atuchin-m
Copy link
Contributor Author

Greaselion old ticket about startup perf: #21366

@iefremov iefremov added this to To do in Perf via automation Nov 5, 2023
@atuchin-m
Copy link
Contributor Author

#34480

@atuchin-m
Copy link
Contributor Author

Let's sum up the related work:

  1. The Wallet problem was fixed: (Optimize json sanitizing in Wallet #30940).
  2. The double adblock work on startup was fixed: ([perf] Fix double rebuilding of default ruleset #33718)
  3. HTTP Everywhere was removed: Remove obsolete HTTPS Everywhere list from Brave since it's no longer needed #28433
  4. Greaselion issue is open (no active maintainer)

That iteration of optimization for startup CPU usage can be considered as done.

@atuchin-m
Copy link
Contributor Author

Another data-decoder issue: #35886
json parsing could be triggered during startup in several scenarios (e.g. when brave news is enabled).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS/Android Fixes related to Android browser functionality OS/Desktop perf QA/No release-notes/exclude
Projects
Perf
To do
Development

No branches or pull requests

1 participant