Twitter
Essays
Random
« The Salt Lick | Main | Tamarin Benchmarks Part 3 »
Monday
Apr282008

Tamarin Benchmarks - Now Featuring Type Annotations

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:
Tamarin-Central Compiler
time ./shell -Dforcemir ~/Projects/tamarin-central/test/custom/forLoop.abc

real 0m0.452s
user 0m0.445s
sys 0m0.007s

Tamarin-Tracing Single Interpreter - Compiler on
time ./avmplus ~/Projects/tamarin-central/test/custom/forLoop.abc

real 0m5.006s
user 0m4.923s
sys 0m0.041s

Tamarin-Tracing Double Interpreter - Compiler on
time ./avmplus ~/Projects/tamarin-central/test/custom/forLoop.abc

real 0m6.529s
user 0m6.496s
sys 0m0.033s

SpiderMonkey 1.8 (Copied from previous post for convenience)
time ./js ~/Projects/tamarin-central/test/custom/forLoop.js

real 0m6.396s
user 0m6.385s
sys 0m0.011s

Even with type annotations, Tamarin squeaks by SpiderMonkey 1.8. Remember, the previous test was untyped code.

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.abc

real 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.

PrintView Printer Friendly Version

EmailEmail Article to Friend

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.

April 28, 2008 | Unregistered CommenterAndreas Gal

mason, I think you also want to use the -Dforcemir option for the tamarin central code.

May 6, 2008 | Unregistered CommenterRick

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>