Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate limit scrolling history.replaceState #134

Closed

Conversation

hyperair
Copy link
Contributor

@hyperair hyperair commented Jun 17, 2018

Scrolling on Chrome Beta for Linux with native smooth scrolling generates a pretty high frequency of scroll events which results in choppy scrolling behaviour. Chrome Inspector shows a repeated message of:

Throttling history state changes to prevent the browser from hanging.

This PR rate-limits the updateScrollHistory call to avoid those stalls.

@hyperair hyperair changed the title Rate limit scrolling pushstate Rate limit scrolling history.replaceState Jun 17, 2018
@wdu
Copy link
Contributor

wdu commented Jun 18, 2018

Thanks for the patch.

Would it be possible to modify the patch so that the arguments of the last invocation of proxy() before the timeout are used instead of the arguments at the time of creation of the timer? I don't trust my JS skills enough to simply move the 'var args = arguments;' line to above the 'if (timer)' test, but do you get what I mean?

Wim.

When scrolling in Linux using Chrome and XInput2 high resolution scrolling,
scroll events at a high frequency, causing a high frequency of
history.replaceState calls. Reduce that by clamping it to a max period of 10ms.
@hyperair hyperair force-pushed the rate-limit-scrolling-pushstate branch from de615a7 to 31d3bf1 Compare June 18, 2018 18:42
@hyperair
Copy link
Contributor Author

Alright, done.

@emweb
Copy link
Collaborator

emweb commented Jun 19, 2018

I minified Wt.min.js myself and did a manual merge of this patch to both the wt3 and master branches.

Thanks,
Roel

@emweb emweb closed this Jun 19, 2018
@hyperair
Copy link
Contributor Author

hyperair commented Jun 19, 2018 via email

@hyperair hyperair deleted the rate-limit-scrolling-pushstate branch June 19, 2018 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants