The section of RenderViewHostImpl::ComputeWebkitPrefs that gathers ui:: prefs hurts WebView startup performance |
||
Issue description
This section of RenderViewHostImpl::ComputeWebkitPrefs takes most of its time (9-10ms):
prefs.touch_enabled = ui::AreTouchEventsEnabled();
prefs.device_supports_touch = prefs.touch_enabled &&
ui::GetTouchScreensAvailability() ==
ui::TouchScreensAvailability::ENABLED;
prefs.available_pointer_types = ui::GetAvailablePointerTypes();
prefs.primary_pointer_type = ui::GetPrimaryPointerType();
prefs.available_hover_types = ui::GetAvailableHoverTypes();
prefs.primary_hover_type = ui::GetPrimaryHoverType();
...
prefs.pointer_events_max_touch_points = ui::MaxTouchPoints();
It seems that it is currently written in a suboptimal way -- each of the pointer / hover getters go into Java where they iterate over the list of InputDevices (see ui/android/java/src/org/chromium/ui/base/TouchDevice.java). I guess, this can be easily replaced with just a single call doing only one iteration, taking 3x less time.
,
Sep 6 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4cef7d0449592119bc8bdee2b5a98c89543f4c03 commit 4cef7d0449592119bc8bdee2b5a98c89543f4c03 Author: tobiasjs <tobiasjs@chromium.org> Date: Tue Sep 06 16:44:29 2016 Optimization: avoid making 4 JNI calls to get touch device attributes. Each call (Get{Available|Primary}{Pointer|Hover}Type) does a separate iteration over the input device list, as well as incurring JNI call overhead. By fetching the Pointer and Hover types in one call, and then reusing the values, we can avoid unnecessary work on the WebView startup path. BUG= 600060 Review-Url: https://codereview.chromium.org/2301073002 Cr-Commit-Position: refs/heads/master@{#416644} [modify] https://crrev.com/4cef7d0449592119bc8bdee2b5a98c89543f4c03/content/browser/renderer_host/render_view_host_impl.cc [modify] https://crrev.com/4cef7d0449592119bc8bdee2b5a98c89543f4c03/ui/android/java/src/org/chromium/ui/base/TouchDevice.java [modify] https://crrev.com/4cef7d0449592119bc8bdee2b5a98c89543f4c03/ui/base/touch/touch_device.cc [modify] https://crrev.com/4cef7d0449592119bc8bdee2b5a98c89543f4c03/ui/base/touch/touch_device.h [modify] https://crrev.com/4cef7d0449592119bc8bdee2b5a98c89543f4c03/ui/base/touch/touch_device_android.cc [modify] https://crrev.com/4cef7d0449592119bc8bdee2b5a98c89543f4c03/ui/base/touch/touch_device_linux.cc [modify] https://crrev.com/4cef7d0449592119bc8bdee2b5a98c89543f4c03/ui/base/touch/touch_device_win.cc
,
Sep 7 2016
Fixed, but doesn't appear to have made any appreciable difference to startup time. |
||
►
Sign in to add a comment |
||
Comment 1 by hush@chromium.org
, Aug 31 2016