Skip to content

Instantly share code, notes, and snippets.

@RobertDaleSmith
Created November 20, 2015 23:15
Show Gist options
  • Save RobertDaleSmith/cd2896fa71c76021ef9e to your computer and use it in GitHub Desktop.
Save RobertDaleSmith/cd2896fa71c76021ef9e to your computer and use it in GitHub Desktop.
Used to compare time it takes execute two different javascript lines.
function test(option){
var start = Date.now();
var result;
if(option){
result = $('body').find('p + p + p').parent();
}else{
result = $('body').find(':has(> p + p + p)');
}
var end = Date.now();
return (end - start);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment