reduce thread-hopping in WallpaperColorCalculator |
||||||||
Issue descriptionEvery time we use WallpaperColorCalculator, we post a task to another thread. This is overkill for cases where color extraction will be very fast (e.g. a 1x1 wallpaper which is being used to create a solid color effect). Hopefully the color extraction will become fast enough to just run on the UI thread. In the mean time, we should move color extraction operations on very small images onto the main thread.
,
Apr 18 2017
The code complexity is minimal. We'd only need to make sure the callers wouldn't choke on a synchronous return. On some local runs the elapsed time with the thread hop is ~15ms and without is 0 (for the tiny image case). The delay varies with how busy the system is. It seems we run this at startup when the system is often very busy.
,
Apr 18 2017
15 ms seems worth it. Thanks for measuring.
,
Apr 18 2017
CL: https://codereview.chromium.org/2824883006/
,
Apr 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8 commit e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8 Author: bruthig <bruthig@chromium.org> Date: Tue Apr 25 19:27:47 2017 [ash-md] Reduce thread hopping for cheap wallpaper color extraction. Recent optimizations to the color_analysis::CalculateProminentColorOfBitmap() has made it more expensive to perform color extraction asynchronously in some cases. This change uses a simple image size heuristic to decide whether to extract colors synchronously or asynchronously. The optimizations made the 0-3 minute scale for the 'Ash.Wallpaper.TimeSpentExtractingColors' histogram overkill so it was replaced with 'Ash.Wallpaper.ColorExtraction.Durations' one which uses a 0-10 second scale. This change also includes a new 'Ash.Wallpaper.ColorExtraction.UserDelay' histogram that includes the thread switching delays incurred by asynchronous calculations. BUG=595010, 712714 TEST=components_unittests --gtest_filter=*WallPaperColorCalculator*yncTest* Review-Url: https://codereview.chromium.org/2824883006 Cr-Commit-Position: refs/heads/master@{#467075} [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/components/wallpaper/wallpaper_color_calculator.cc [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/components/wallpaper/wallpaper_color_calculator.h [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/components/wallpaper/wallpaper_color_calculator_unittest.cc [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/tools/metrics/histograms/histograms.xml
,
Apr 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8 commit e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8 Author: bruthig <bruthig@chromium.org> Date: Tue Apr 25 19:27:47 2017 [ash-md] Reduce thread hopping for cheap wallpaper color extraction. Recent optimizations to the color_analysis::CalculateProminentColorOfBitmap() has made it more expensive to perform color extraction asynchronously in some cases. This change uses a simple image size heuristic to decide whether to extract colors synchronously or asynchronously. The optimizations made the 0-3 minute scale for the 'Ash.Wallpaper.TimeSpentExtractingColors' histogram overkill so it was replaced with 'Ash.Wallpaper.ColorExtraction.Durations' one which uses a 0-10 second scale. This change also includes a new 'Ash.Wallpaper.ColorExtraction.UserDelay' histogram that includes the thread switching delays incurred by asynchronous calculations. BUG=595010, 712714 TEST=components_unittests --gtest_filter=*WallPaperColorCalculator*yncTest* Review-Url: https://codereview.chromium.org/2824883006 Cr-Commit-Position: refs/heads/master@{#467075} [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/components/wallpaper/wallpaper_color_calculator.cc [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/components/wallpaper/wallpaper_color_calculator.h [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/components/wallpaper/wallpaper_color_calculator_unittest.cc [modify] https://crrev.com/e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8/tools/metrics/histograms/histograms.xml
,
May 1 2017
Verified on veyron_minnie v 60.0.3084.0
,
May 1 2017
Your change meets the bar and is auto-approved for M59. Please go ahead and merge the CL to branch 3071 manually. Please contact milestone owner if you have questions. Owners: amineer@(Android), cmasso@(iOS), gkihumba@(ChromeOS), Abdul Syed@(Desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
May 1 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b04dec51600619369fb66ae642960d5df26bdbcd commit b04dec51600619369fb66ae642960d5df26bdbcd Author: Ben Ruthig <bruthig@chromium.org> Date: Mon May 01 16:20:26 2017 [ash-md] Reduce thread hopping for cheap wallpaper color extraction. Recent optimizations to the color_analysis::CalculateProminentColorOfBitmap() has made it more expensive to perform color extraction asynchronously in some cases. This change uses a simple image size heuristic to decide whether to extract colors synchronously or asynchronously. The optimizations made the 0-3 minute scale for the 'Ash.Wallpaper.TimeSpentExtractingColors' histogram overkill so it was replaced with 'Ash.Wallpaper.ColorExtraction.Durations' one which uses a 0-10 second scale. This change also includes a new 'Ash.Wallpaper.ColorExtraction.UserDelay' histogram that includes the thread switching delays incurred by asynchronous calculations. BUG=595010, 712714 TEST=components_unittests --gtest_filter=*WallPaperColorCalculator*yncTest* Review-Url: https://codereview.chromium.org/2824883006 Cr-Commit-Position: refs/heads/master@{#467075} (cherry picked from commit e4135c8d12a6554d16e3bf16a8b79bb6462aa7d8) Review-Url: https://codereview.chromium.org/2849163002 . Cr-Commit-Position: refs/branch-heads/3071@{#324} Cr-Branched-From: a106f0abbf69dad349d4aaf4bcc4f5d376dd2377-refs/heads/master@{#464641} [modify] https://crrev.com/b04dec51600619369fb66ae642960d5df26bdbcd/components/wallpaper/wallpaper_color_calculator.cc [modify] https://crrev.com/b04dec51600619369fb66ae642960d5df26bdbcd/components/wallpaper/wallpaper_color_calculator.h [modify] https://crrev.com/b04dec51600619369fb66ae642960d5df26bdbcd/components/wallpaper/wallpaper_color_calculator_unittest.cc [modify] https://crrev.com/b04dec51600619369fb66ae642960d5df26bdbcd/tools/metrics/histograms/histograms.xml
,
May 1 2017
,
Aug 1 2017
,
Jan 22 2018
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by jamescook@chromium.org
, Apr 18 2017