Try/Catch Block Performance Comparison for middleware

JavaScript performance comparison

Revision 15 of this test case created by

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var res = {send:function(body){console.log(body)}}
  
  function simple(req,res){
      res.send(req);
  }
  
  function pattern(req,res){
      try {
          res.send(req.body.data);
      } catch (e) {
          res.send(500);
      }
  }

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Plain
simple({body:{data:'test'}}, res)
pending…
Try/Catch Block
pattern({body:{data:'test'}}, res)
pending…
Try/Catch Block With Error
pattern(undefined, res)
pending…

Compare results of other browsers

Revisions

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

0 Comments