Skip to content

Instantly share code, notes, and snippets.

@da2x
Created September 20, 2012 10:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save da2x/3755211 to your computer and use it in GitHub Desktop.
Save da2x/3755211 to your computer and use it in GitHub Desktop.
Bookmarklet for measuring scrolling performance
javascript:q=Date.now();w=0;a=3;s=10;e=setInterval("w+=s;if(w<document.body.scrollHeight&&w>=0)window.scrollTo(0,w);else if(--a){s=-s}else{clearInterval(e);alert(Date.now()-q);}",0);void 0;
@Christoph142
Copy link

javascript:q=Date.now();w=0;a=3;s=10;e=setInterval("w+=s;if(w<document.body.scrollHeight&&w>=0)window.scrollTo(0,w);else if(--a){s=-s}else{clearInterval(e);alert(document.body.scrollHeight>window.innerHeight?('It takes approximately '+Math.round((Date.now()-q)/(3*(document.body.scrollHeight-window.innerHeight)/window.innerHeight))/1000+' seconds to scroll this document by one page'):'scrolling mearsurement is only possible if the window can actually be scrolled!');}",0);void 0;

would be better IMHO, because it gives you an idea of the actual performance and is comparable across websites ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment