Skip to content

Instantly share code, notes, and snippets.

@you21979
Created September 19, 2016 01:20
Show Gist options
  • Save you21979/79aa809fc5dc4b3614826a91c9a0f523 to your computer and use it in GitHub Desktop.
Save you21979/79aa809fc5dc4b3614826a91c9a0f523 to your computer and use it in GitHub Desktop.
trycatch
var x = function(){
try{
for(var i=0;i<100;++i){}
}catch(e){
}
}
var x2 = function(){
for(var i=0;i<100;++i){}
}
var MAX = 100000;
console.time("a")
for(var i=0;i<MAX;++i)x()
console.timeEnd("a")
console.time("b")
for(var i=0;i<MAX;++i)x2()
console.timeEnd("b")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment