IronJS, preview benchmarks of the new compiler

February 3rd, 2010

I just wanted to post some quick performance results of the new compiler I’m working on for IronJS, the new compiler has two very important features the old one didn’t have:

The second point is the most important one; it detects the types of the arguments to functions during runtime, and then recompiles them and then replaces the old generic function with a new one that is compiled especially for its input types. Point 1 and 2 together makes for a pretty hefty performance increase.

The new compiler is still in its infancy and is far from complete at the moment, there are a lot of features lacking currently. But I wanted do a quick performance benchmark to show off its performance compared to its older sibling. I also added V8, TraceMonkey, JScript and Rhino to the mix to give some meaning to the values.

Keep in mind that this is a very very early and limited benchmark. This just test a small part of the runtime.

The code used for the benchmark – passes a number (10,000,000) to a function, and then iterates until it reaches that number – looks like this:

function time(fn) {
    var start = new Date();
    fn();
    var stop = new Date();
    alert(stop - start);
};

var y = function(a) {
    for (var i = 0; i < a; ++i) {

    }

    return i;
};

var i = 0;

time(function() {
    i = y(10000000)
});

And the results of our contestants are

Again, I can’t stress enough how small a part of the runtime this tests. It’s just to give a quick indication that I’m heading in the right direction.