Issue metadata
Sign in to add a comment
|
addEventListener is very slow for touch events
Reported by
roblour...@gmail.com,
Nov 11 2017
|
||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 Steps to reproduce the problem: Call addEventListener with touchstart, touchend, or touchmove - it's much slower than calling it for a touch event. Use the test script - it calls addEventListener 100 times with either the touch events or the mouse events. Calling for the touch events are always much slower. On my machine, typically around .5ms to run the mouse event test, and up to 20ms to run the touch event test. What is the expected behavior? They should both be fast. They are the same speed in FF. What went wrong? Screenshot shows the actual timings. Did this work before? Yes It broke somewhere between Chrome 56 and 58. Still broken in canary 64 Does this work in other browsers? Yes Chrome version: 61.0.3163.100 Channel: n/a OS Version: OS X 10.12.6 Flash Version:
,
Nov 11 2017
Well, "better" was a strong word. :) It was better for touch, but mouse got significantly worse.
,
Nov 12 2017
,
Nov 13 2017
If I remove the lines in the block that log the performance violation all is much faster (https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/events/EventTarget.cpp?type=cs&q=%22Consider+marking+event+handler+as%22&sq=package:chromium&l=304) Seems the slowness all comes from logging the performance violation. Over to the performance api team to determine whether this is fast enough and this issue should be closed.
,
Nov 13 2017
,
Nov 13 2017
Pavel, does this match the performance characteristics you'd expect from PerformanceMonitor::ReportGenericViolation?
,
Dec 28 2017
Unfortunately, it does, but only in case DevTools are open. https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/frame/PerformanceMonitor.cpp?sq=package:chromium&l=356 is capturing the stack to point at the offender. @kozy: capturing 100 stacks at the same location takes 11ms, this sounds slow given your recent improvements on the stack capturing front.
,
Apr 9 2018
100 day ping: Any update on this bug?
,
Jul 20
Ping again. Any update?
,
Nov 5
100 day ping: Has there been any progress here? FWIW, the index.html file from #1 is still showing ~0.5 ms for mouse events and 20-40 ms for touch events on 71.0.3578.21 on my pixelbook... |
|||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||
Comment 1 by phistuck@gmail.com
, Nov 11 2017Looks like the DOM operation might also be affected, because when you only add event listeners to window, it is much better and the difference is less severe - a=performance.now(); for (i=0; i<1000;i++) { addEventListener("touchstart", function () {}); addEventListener("touchmove", function () {}); addEventListener("touchend", function () {}); } b=performance.now(); console.log(a,b,b-a); a=performance.now(); for (i=0; i<1000;i++) { addEventListener("mousedown", function () {}); addEventListener("mousemove", function () {}); addEventListener("mouseup", function () {}); } b=performance.now(); console.log(a,b,b-a); // 222926.515 222960.65000000002 34.13500000000931 // 222961.33500000002 222980.545 19.20999999999185