Try/Catch Block Performance Comparison (v10)

Revision 10 of this benchmark created on


Description

Measuring the performance implications of a try/catch block.

Setup

window.assign10000 = function assign10000() {
      var i = 10000;
      var n;
      while(i--) {
        n = i;
      }
    };
    
    window.assign10000Error = function assign10000Error() {
      var i = 10000;
      var n;
      while(i--) {
        (0)();
      }
    };

Teardown


    delete window.assign10000;
    delete window.assign10000Error;
  

Test runner

Ready to run.

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

Revisions

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