Skip to content

Instantly share code, notes, and snippets.

@Christoph142
Forked from da2x/scrollperformance.js
Last active October 11, 2015 19:57
Show Gist options
  • Save Christoph142/3911042 to your computer and use it in GitHub Desktop.
Save Christoph142/3911042 to your computer and use it in GitHub Desktop.
Bookmarklet for measuring scrolling performance
javascript:q=Date.now();w=0;a=3;s=10;m=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-window.innerHeight+10;e=setInterval("w+=s;if(w<m&&w>=0)window.scrollTo(0,w);else if(--a){s=-s}else{clearInterval(e);alert(Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)>window.innerHeight?('It takes approximately '+Math.round((Date.now()-q)/(3*(Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-window.innerHeight)/window.innerHeight))/1000+' seconds to scroll this document by one page'):'scrolling measurement is only possible if the window can actually be scrolled!');}",0);void 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment