regex-search icon indicating copy to clipboard operation
regex-search copied to clipboard

Potential performance optimizations

Open myfairsyer opened this issue 7 years ago • 0 comments

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.

myfairsyer avatar Nov 16 '17 11:11 myfairsyer