1

In Chrome, there is a noticeable difference in the number of event fires with dev tools open vs closed. The next six lines are copied out of the dev console. The first three were number of event fires while clicking / moving / releasing the mouse while dev tools were open, the next three were while closed:

458
357
204
19
43
25

Oddly, this "throttling" (maybe not?) effects zooming in THREE.js orbit controls with performance being much better only when dev tools are open. The following code exhibits this behavior:

<html>
<head></head>
<body>
    <script type="text/javascript">
    
        let i = 0;
        
        window.addEventListener('mousedown', () => {
            i = 0;
        });
        
        window.addEventListener('mouseup', () => {
            console.log(i);
        });
        
        window.addEventListener('mousemove', () => {
            i++;
        });

    </script>
</body>
</html>

Does anyone know how Chrome handles mouse events? Is it an intended feature to limit the event firing rate only when the dev tools are closed or maybe something else is going on?

obsius
  • 21
  • 1
  • Very curious about this. Does the effect change when you pull devtools into a separate window? Perhaps resizing the page is having some effect? When you are profiling? Here’s another relevant question: https://stackoverflow.com/questions/34432608/javascript-code-works-faster-when-js-profiling-is-on-what – thshea Jun 11 '21 at 00:26
  • @thshea Yeah, it's strange. Only faster when the tab's dev tools window is open. No profiling, just the code from above and mouse clicking / moving with dev tools open vs closed. – obsius Jun 11 '21 at 00:57

0 Answers0