Higher Order Blog


Jeene update: Performance, features and backlog

21 Sep 2008

Don't know what Jeene is? It will make your JavaScript code run faster ;-) read the intro first, then come back to this!

Performance examples

I was curious about the performance gains of functions specialized via Jeene, so I ran a simple performance example in Firefox 2 and 3; Safari 3.1.2; Opera 9.52; SquirrelFish Extreme (the new JIT); IE 6, 7 ; Google's Chrome and finally, TraceMonkey. All with great results! You can run the simple example here. The test executes the string concatenation example from the previous post. The actual example is not that interesting; what is interesting is that Jeene works in all current popular JavaScript implementations and that it gives good performance boosts also in the new JITs: V8, TraceMonkey and SquirrelFish Extreme. The figures include the time it takes to specialize the function, so they are actual performance gains. (Note that the Windows and Mac tests were on different hardware).

What can Jeene do right now?

Specialize JavaScript functions written in simplified JavaScript which contain the following constructs (note as of now you can only specialize with primitive values, e.g., strings and numbers; this will be fixed soon):

What Jeene can't do right now (i.e., what I am working on).

Some of these are easy, others are harder and need careful analysis.

New in latest svn commit

Jeene can now handle simple assignments of the form (x = exp) where x is a variable and exp is an expression. Further, formal parameters which are specialized disappear from the formal parameters in the specialized function, but now appear as local variables of that function (so that one can assign to them). Consider this example:
Function.prototype.specialize = net.higherorder.jeene.Jeene.make();
source_fun = function(a,b,c) {
    c = a;
    return b+c;
var env = {a:3, b:2};
res = source_fun.specialize(env);

Result: (function (c) {var a, b;return 5;})

Note that the assignment c=a; can be eliminated and the static value of a is propagated to c so that the expression returned is static. Neat ;-) Check back for more later...