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

Removed dirty checking, minor optimizations #135

Merged
merged 6 commits into from
Dec 19, 2016
Merged

Removed dirty checking, minor optimizations #135

merged 6 commits into from
Dec 19, 2016

Conversation

luzat
Copy link
Contributor

@luzat luzat commented Nov 4, 2016

An update will now only be queued through requestAnimationFrame whenever
changes occurred. This means that absolutely no code is running when the
page is idling (helpful for power saving and scalability). Care was
taken to first read from the DOM and afterwards update it in the new
scroll handler to prevent any possible layout thrashing as described here:

http://wilsonpage.co.uk/preventing-layout-thrashing/

lastWidth, lastHeight and all sensor properties are only updated
once every frame.

An update will now only be queued through requestAnimationFrame whenever
changes occurred. This means that absolutely no code is running when the
page is idling (helpful for power saving and scalability). Care was
taken to first read from the DOM and afterwards update it in the new
scroll handler to prevent any possible layout thrashing as described here:

http://wilsonpage.co.uk/preventing-layout-thrashing/

lastWidth, lastHeight and all sensor properties are only updated
once every frame.
An element may change its size multiple times during a frame. Do not
emit events anymore if its size returned to its previous size since the
last update. This means that events occurring in between two frames -
which are never visible to the user - may be skipped.
Sensors need to be reset even if the element's size returned to its
original dimensions.
@luzat
Copy link
Contributor Author

luzat commented Nov 4, 2016

Commit cd5bda1 and the fix in dd75317 change semantics slightly in that updates which are reverted before the next frame will not invoke handlers.

Resetting within the requestAnimationFrame handler lead to bad
performance. This was noticeable in the performance demo where this
version fares about as good as older versions.
@landabaso landabaso mentioned this pull request Nov 19, 2016
@marcj marcj merged commit d9acc18 into marcj:master Dec 19, 2016
@marcj
Copy link
Owner

marcj commented Dec 19, 2016

Nice addition, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants