Try/Catch Block Performance Comparison (v11)

Revision 11 of this benchmark created on


Description

Measuring the performance implications of a try/catch block.

Setup

window.assign1000 = function assign1000() {
      var i = 1000;
      var n;
      while(i--) {
        n = i;
      }
    };
    
    window.assign1000Error = function assign1000Error() {
      var i = 1000;
      var n;
      while(i--) {
        (0)();
      }
    };

Teardown


    delete window.assign1000;
    delete window.assign1000Error;
  

Test runner

Ready to run.

Testing in
TestOps/sec
Plain
assign1000();
ready
Try/Catch Block
try{
  assign1000();
}catch(e){}
ready
Try/Catch Block With Error
try{
  assign1000Error();
}catch(e){}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.