brave / brave-browser

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

[perf] Fix the rest UI thread heavy tasks in Brave News on UI thread #35890

Closed atuchin-m closed 1 month ago

atuchin-m commented 7 months ago

A issue to fix the rest of https://github.com/brave/brave-browser/issues/35695 The #perf thread: https://bravesoftware.slack.com/archives/C3T9S9WKD/p1706889037498549?thread_ts=1706626988.579219&cid=C3T9S9WKD

  1. large data are still stored/iterated on UI thread: https://github.com/brave/brave-core/pull/21833#discussion_r1477747653
  2. other similar places in brave_news that process base::Value and builds something after (e.g. getting the list of sources)
  3. private_cdn_request_helper callbacks: https://github.com/brave/brave-core/blob/master/components/brave_news/browser/brave_news_controller.cc#L429-L453
atuchin-m commented 6 months ago

Some extra details: this is ParseCombinedPublisherList work (+the following callbacks) on the UI thread (19ms on a high end workstation) image

image
MadhaviSeelam commented 1 week ago

Verification PASSED using

Brave | 1.70.92 Chromium: 128.0.6613.85 (Official Build) beta (64-bit)
-- | --
Revision | 711f50838f629ac2be4d1d9592f72adecfd3c928
OS | Windows 11 Version 23H2 (Build 22631.4112)
  1. Installed 1.70.94
  2. launched Brave
  3. completed onboarding
  4. clicked News >> Turn on Brave News
  5. confirmed Brave News feed loaded expected
  6. clicked on a news card (eg. Serious Eats)
  7. verified news article opened in a new tab (https://www.seriouseats.com/how-to-store-raspberries-8703108)
  8. confirmed Manage subscriptions button is shown in the toolbar in the article
  9. clicked Manage subscriptions in the toolbar
  10. clicked Follow button
  11. returned to Brave news feed tab
  12. confirmed the publication Serious Eats is shown in Publishers list
  13. confirmed New content available. Reload? button shown
  14. clicked the button and news feed refreshed
  15. clicked Following in the left side panel
  16. confirmed Serious Eats cards are shown in the Following
  17. return to the news article tab
  18. clicked again Manage subscriptions in the toolbar
  19. clicked Unfollow button
  20. return to news feed
  21. confirmed Serious Eats source is removed from Publishers list
  22. clicked New content available, Reload?
  23. confirmed page news feed refreshed and Serious Eats source was removed from Following as well
  24. clicked + sign next to Channels in the Panel left of the feed
  25. added a channel (eg.Cars) in the Brave News dashboard
  26. closed the dashboard
  27. confirmed New content available, Reload?message shown
  28. confirmed Cars is shown in the Channels
  29. clicked Cars
  30. confirmed Channel feed for Cars is loaded
step 5-6 step 7-10 step 12-13 step 15-16 step 17-19 step 21 step 23 step 25 step 27 step 30
image image image image image image image image image image