Skip to content

Instantly share code, notes, and snippets.

@courajs
Created November 4, 2015 14:33
Show Gist options
  • Save courajs/1e3da800c69b94c3ebd1 to your computer and use it in GitHub Desktop.
Save courajs/1e3da800c69b94c3ebd1 to your computer and use it in GitHub Desktop.
Profile a synchronous function
window.profileSync = function profileSync(name, f){
return function(){
console.log("starting "+name)
start_time = new Date()
f.apply(this, arguments)
end_time = new Date()
time = (end_time - start_time) / 1000
console.log("finished "+name+" in "+time+" seconds.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment