Tamarin Benchmarks - Now Featuring Type Annotations
Monday, April 28, 2008 Andreas pointed out that the for loop example might be a bit more interesting if we add type annotations to the source. So let's take another look at Tamarin with added type annotations. The new found source:
package{
var j:Number = 0;
for (var i:Number = 0; i < 100000000; i++) {
j++;
}
}
Here are the numbers:Even with type annotations, Tamarin squeaks by SpiderMonkey 1.8. Remember, the previous test was untyped code.Tamarin-Central Compiler
time ./shell -Dforcemir ~/Projects/tamarin-central/test/custom/forLoop.abcreal 0m0.452s
user 0m0.445s
sys 0m0.007sTamarin-Tracing Single Interpreter - Compiler on
time ./avmplus ~/Projects/tamarin-central/test/custom/forLoop.abcreal 0m5.006s
user 0m4.923s
sys 0m0.041sTamarin-Tracing Double Interpreter - Compiler on
time ./avmplus ~/Projects/tamarin-central/test/custom/forLoop.abcreal 0m6.529s
user 0m6.496s
sys 0m0.033sSpiderMonkey 1.8 (Copied from previous post for convenience)
time ./js ~/Projects/tamarin-central/test/custom/forLoop.jsreal 0m6.396s
user 0m6.385s
sys 0m0.011s
Finally, what if we change the type from Number to integer. The new source code:
package{
var j:int = 0;
for (var i:int = 0; i < 100000000; i++) {
j++;
}
}
And the results:Tamarin-Tracing Single Interpreter - Compiler on
time ./avmplus ~/Projects/tamarin-central/test/custom/forLoop.abcreal 0m2.384s
user 0m2.331s
sys 0m0.034s
Tamarin-Tracing Double Interpreter - Compiler on
time ./avmplus ~/Projects/tamarin-central/test/custom/forLoop.abc
real 0m1.301s
user 0m1.273s
sys 0m0.027s
Tamarin-Central - Compiler on
time ./shell -Dforcemir ~/Projects/tamarin-central/test/custom/forLoop.abc
real 0m0.373s
user 0m0.362s
sys 0m0.007s
The resulting speed boost from using an integer type is quite nice.*Added the flag -Dforcemir to tamarin-central to force compilation. Thx for the tip Rick.
2 Comments | |
Permalink
Benchmarks,
JavaScript,
SpiderMonkey,
Tamarin 
Reader Comments (2)
Better, but now you are forcing tamarin to use doubles because you told it that i/j are numbers. Try "int" instead. Due to the lax semantics of type annotations tamarin still has to emit code to do overflow checks, but at least it should be able to use integer arithmetics.
mason, I think you also want to use the -Dforcemir option for the tamarin central code.