Error.stackTraceLimit

JavaScript performance comparison

Revision 2 of this test case created by derry

Info

Testing performance for Error.stackTraceLimit for different versions of Chrome/Chromium (feature specific for V8).

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function get_stack(){
      var orig = Error.prepareStackTrace;
      Error.prepareStackTrace = function(_, stack){ return stack; };
      var err = new Error;
      Error.captureStackTrace(err, arguments.callee);
      var stack = err.stack;
      Error.prepareStackTrace = orig;
      return stack;
    };
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Error.stackTraceLimit = Infinity;
Error.stackTraceLimit = Infinity;

function MyError() {
  Error.captureStackTrace(this, MyError);
}

try {
  throw new MyError();
} catch(e) {}
pending…
Error.stackTraceLimit = 10;
Error.stackTraceLimit = 10;

function MyError() {
  Error.captureStackTrace(this, MyError);
}

try {
  throw new MyError();
} catch(e) {}
pending…
Error.stackTraceLimit = 2;
Error.stackTraceLimit = 2;

function MyError() {
  Error.captureStackTrace(this, MyError);
}

try {
  throw new MyError();
} catch(e) {}
pending…
captureStackTrace 2
Error.stackTraceLimit = 2;
get_stack();
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. Here’s a list of current revisions for this page:

0 comments

Add a comment