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

Potential performance optimizations #40

Open
myfairsyer opened this issue Nov 16, 2017 · 0 comments
Open

Potential performance optimizations #40

myfairsyer opened this issue Nov 16, 2017 · 0 comments

Comments

@myfairsyer
Copy link

I neither faced any performance issues myself nor did I run extensive benchmarks on what I'm suggesting.

The points do not come from my personal experience either, some are even rather hearsay so take it with a grain of salt.

  1. During scrolling it looks like you j-query both the elements and the body just to use the jQuery methods .scrollTop() and .offset(). Vanilla JS might bring performance gains here.
  2. In recurse you also j-query each element and then use .css() to access their display style. Plain vanilla JSshould also be more performant here.
  3. In elementInViewport you walk up the parent chain. getBoundingClientRect() should usually be more performant.

I did see JSPerfs supporting these claims at least on my machine and current browser so I might (or might not) add them here later.

Again: I neither reviewed those JSPerfs, nor did I run them on multiple browsers or devices, nor did I performance-test in the context of your code.

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

No branches or pull requests

1 participant