Performance of tamarin-tracing interpreter

Edwin Smith edwsmith at
Thu Jan 17 13:39:32 PST 2008

Several reasons, as a matter of fact

1. even if tt had the same interpreter as tc, it would be slower because
of a bunch of other things done in tt to reduce memory usage and
(strings are Utf8 vs utf16, arrays, xml, and several other builtins
in actionscript instead of c++, Traits/MethodInfo object graph is gone,
by a few caches of the same information).  these saved a lot of
code/memory but
cost some speed.  (speed which we expect to recover as the project

2. tt's interpreter is a forth interpreter and ABC opcodes are
dispatched to
forth subroutines, so tt does a lot more bytecode dispatching than tc
this was done to reduce code footprint and to enable tracing.  

a core concept in tracing is that you trace the common path, and if code
takes an un-traced branch, you revert to the interpreter.  if the ABC
was written in C++, then we would have to interpret & trace x86
in theory that's possible but we felt it was too low level.

tt's interpreter is not re-entrant, and many opcodes can contain
calls.  (e.g. x+"a" can invoke x.toString().  x[i] can invoke an
accessor depending on whether x is Object, Array, XML, etc).

writing things in forth enabled us to be able to trace all these
steps, using primitives that are high level enough to enable
optimizations but low level enough to not have to do re-entrant things
in C
and low level enough to expose enough redundancy to the trace optimizer.

what we are doing about it

* several outstanding tasks to analyze/optimize the forth code by hand
* superwords are used to compile common sequences of forth into a slab
  faster C, without losing the ability to trace the sequence.
* planning to use the tracer in all but the most severely constrained
  embeddings (anything with, say, 8M or more could support tracing)
* when compiled with GCC, the interpreter uses computed goto's like any
  self respecting threaded interpreter should, but there is likely more
  tweaking to make the interpreter itself faster. (many papers on vmgen
  and gnu forth on the subject).
* theres grab bags of things TC optimizes for, that TT doesn't, things
  that just got tossed out during the engine rebuild.  many should be
  added back in without impacting memory/footprint.

where we especially don't want to lose too much speed is initialization
that only runs once.  such code will never be traced and you want the
to be as fast as possible for that kind of code.

-----Original Message-----
From: tamarin-devel-bounces at
[mailto:tamarin-devel-bounces at] On Behalf Of Zbynek Winkler
Sent: Thursday, January 17, 2008 3:53 PM
To: tamarin-devel at
Subject: Performance of tamarin-tracing interpreter


is there a specific reason why tamarin-tracing in interpreter mode is
so much slower (up to about 25 times) than tamarin-central?



test                                                    tc      tt

untyped/               429    1675
untyped/                        695   19870
untyped/                      634    9780
untyped/                854   16352
untyped/             410   13882
untyped/               195    1292
untyped/             206    1595
untyped/          189    1362
untyped/                      489    9198
untyped/                          518    9257
untyped/                633    8287
untyped/                 678    6129
untyped/                         684    6101
untyped/                  1499   40799
untyped/                       522    5885
untyped/                      648    4118
untyped/                       320    3716
untyped/                        307    5446
untyped/                    1000   12212
untyped/                413    3803
typed/                 327    1555
typed/                          713   19242
typed/                        411    6089
typed/                  893   15816
typed/               401   13737
typed/                 198    1377
typed/               247    1685
typed/            215    1540
typed/                        514    9203
typed/                            528    9232
typed/                  155     423
typed/                   414    2829
typed/                           671    6080
typed/                    1555   40612
typed/                         574    5962
typed/                        667    4099
typed/                         399    3871
typed/                          398    5152
typed/                       996   11856
typed/                  338    3722

Tamarin-devel mailing list
Tamarin-devel at

More information about the Tamarin-devel mailing list