Version 9 of Tcl OO Bench

Updated 2004-02-26 18:06:39

This comparison of OO extensions of Tcl is based on OO benchmarks of the OO shootout [L1 ] and consists of the OO Method calls (source [L2 ]) and the Object Instantiation Test (Source [L3 ]).

These tests were performed on a Pentium 4 M Notebook with 1400 MHz under Fedora Core 1.0.

 XOTcl 1.2.0
   methcall  0.470u 0.000s 0:00.41 114.6%       0+0k 0+0io 347pf+0w
   objinst   0.960u 0.000s 0:00.97 98.9%        0+0k 0+0io 348pf+0w
 ITcl emulation in XOTcl
   methcall  0.590u 0.000s 0:00.62 95.1%        0+0k 0+0io 351pf+0w
   objinst   1.780u 0.000s 0:01.81 98.3%        0+0k 0+0io 353pf+0w
 OTcl 1.0
   methcall  0.980u 0.000s 0:00.95 103.1%       0+0k 0+0io 329pf+0w
   objinst   2.370u 0.010s 0:02.37 100.4%       0+0k 0+0io 329pf+0w
 itcl 3.2
   methcall  0.870u 0.020s 0:00.92 96.7%        0+0k 0+0io 347pf+0w
   objinst   1.790u 0.010s 0:01.84 97.8%        0+0k 0+0io 348pf+0w
 stooop 4.4
   methcall  1.690u 0.010s 0:01.73 98.2%        0+0k 0+0io 326pf+0w
   objinst   4.020u 0.010s 0:04.06 99.2%        0+0k 0+0io 316pf+0w
 classytcl 1.0
   methcall  0.740u 0.010s 0:00.78 96.1%        0+0k 0+0io 335pf+0w
   objinst   3.020u 0.030s 0:03.09 98.7%        0+0k 0+0io 335pf+0w

The full source and results are available at [L4 ].


Please note that for stooop, in the method call benchmark, the value procedure has no reason to be virtual since it only returns the value of a data member in its class. Removing the virtual qualifier results in a huge improvement in speed (on my Xeon 2.4 GHz Fedora 1 Linux machine, with Tcl 8.4.5):

real 0m1.668s, user 0m1.660s, sys 0m0.010s -> real 0m0.394s, user 0m0.390s, sys 0m0.010s

Jean-Luc Fontaine


Also, here are the memory consumption results, which are as interesting in my opinion:

creating 10000 objects itcl

   Used memory: 4640768
   Memory per itcl object: 464
   Time per object: 9.43

otcl

   Used memory: 2838528
   Memory per otcl object: 283
   Time per object: 17.62

XOTcl

   Used memory: 2162688
   Memory per xotcl object: 216
   Time per object: 7.72

Stooop

   Used memory: 1351680
   Memory per stooop object: 135
   Time per object: 22.36

ClassyTcl

   Used memory: 8835072
   Memory per classy tcl object: 883
   Time per object: 548

Snit

   Used memory: 20787200
   Memory per snit object: 2078
   Time per object: 2006.91

Jean-Luc