title: Faster scrolling without onScroll?
body: <p>I was getting really excited after reading <a href="https://gist.github.com/Warry/4254579" rel="nofollow">this article</a> about faster scroll effects. I went implementing Warry's method to see if I could spot any difference in performance - compared to using the scroll event listener:</p>
  
  <pre><code>window.addEventListener('scroll', function() {
      console.log('Scrolling: ' + window.pageYOffset);
  });
  </code></pre>
  
  <p>Code from article:</p>
  
  <pre><code>function loop() {
      if (lastPosition == window.pageYOffset) {
          requestAnimationFrame(loop);
          return false;
      } else lastPosition = window.pageYOffset;
  
      console.log('Scrolling: ' + window.pageYOffset);
      // make sticky calculations...
  
      requestAnimationFrame(loop);
  }
  loop(); // start loop
  </code></pre>
  
  <p>These two pieces of code output the same (Y)offset and seem to be equivalent performance-wise. So my question is: Is the article right?</p>
  
  <p>Also, how does <code>requestAnimationFrame</code> fits in this picture? I know that it tells the browser that it wishes to perform a re-paint. Or... is position fixed simply the way to go? I'm interested in this topic because I'm working on a plugin for sticky elements.</p>
  
  <p>Any info or advice is appreciated!</p>