stacktrace generation

JavaScript performance comparison

Revision 3 of this test case created by derry

Info

does delayed access to stack trace matter?

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    Error.stackTraceLimit = 10;
};
</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
create error and touch stack property (ignore on Safari)
var error = new Error();

error.stack;
pending…
create error, catch it and touch stack property
var error
try {
  throw new Error();
} catch(e) {
  error = e;
}

error.stack;
pending…
grab error and touch stack via type error
var error
try {
  0(); // intentional type error
} catch(e) {
  error = e;
}

error.stack
pending…
dont touch stack
var error = new Error();
pending…
dont touch stack
Error.stackTraceLimit = 2;
var error = new Error();
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