GC performance hit test

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function render_pos(alpha, beta, gamma, delta) {
      var omega = alpha + beta + gamma + delta;
    }
   
    function render_obj(opts) {
      var omega = opts.alpha + opts.beta + opts.gamma + opts.delta;
    }
   
    var N = 1e3;
   
    function main_loop(f, g, n) {
      if (n < 0) {
        g();
      }
      else {
        setTimeout(function() {
          f();
          main_loop(f, n - 1);
        }, 0);
      }
    }
   
    function R() { return ~~(100*Math.random()) }
};
</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
positional
// async test
main_loop(function() {
  render_pos(
    R(),
    R(),
    R(),
    R()
  );
}, function() { deferred.resolve() });
pending…
object
// async test
main_loop(function() {
  render_obj({
    alpha : R(),
    beta  : R(),
    gamma : R(),
    delta : R()
  })
}, function() { deferred.resolve() });
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