Comparing Performance of Tcl OO extensions

Purpose: provide a place to document various (hopefully fair) comparisons of performance between the various object oriented extensions available for tcl (see Object orientation for a list). See also Tcl Performance.


In late Oct, 2001, Gustaf Neumann wrote [L1 ]

 Here is an comparison between a few Tcl OO-extensions ([XOTcl], OTcl,
 itcl, stoop, and classytcl) in terms of performance and memory
 consumption. These tests were performed with XOTcl 0.9.1 on a Pentium
 III Notebook with 600 MHz under RedHat Linux 7.0. The full test with
 all sources can be found on the
 download page of www.xotcl.org [http://www.xotcl.org/]

 best regards
 -gustaf neumann
 ================================================================================
 These are the usual two shootout

(http://shootout.alioth.debian.org/old/ ) MS notes that these benchmarks seem to have been dropped, but can still be found at [L2 ].

 tests:

 XOTcl
  methcall:  2.040u 0.010s 0:02.05 100.0% 0+0k 0+0io 283pf+0w
  objinst:   4.730u 0.030s 0:04.76 100.0% 0+0k 0+0io 283pf+0w
 OTcl
  methcall:  4.050u 0.000s 0:04.04 100.2% 0+0k 0+0io 330pf+0w
  objinst:   9.240u 0.010s 0:09.24 100.1% 0+0k 0+0io 330pf+0w
 itcl
  methcall:  3.130u 0.000s 0:03.12 100.3% 0+0k 0+0io 285pf+0w
  objinst:   6.040u 0.000s 0:06.03 100.1% 0+0k 0+0io 286pf+0w
 stooop
  methcall:  6.930u 0.010s 0:06.94 100.0% 0+0k 0+0io 259pf+0w
  objinst:   14.180u 0.000s 0:14.17 100.0% 0+0k 0+0io 259pf+0w
 classytcl
  methcall:  3.030u 0.020s 0:03.04 100.3% 0+0k 0+0io 284pf+0w
  objinst:   8.980u 0.040s 0:09.02 100.0% 0+0k 0+0io 284pf+0w
 ================================================================================
 This test measures the memory consumption (in bytes) of objects based
 on the
 figures reported by /bin/ps. These figures contain everything that
 is allocated withing Tcl as well (e.g. command structures, namespaces,
 etc). e.g. 10000 xotcl objects consume roughly 2 MB of memory.

 creating 10000 objects
 itcl
   Used memory: 3002368
   Memory per itcl object: 300
   Time per object: 33

 otcl
   Used memory: 2777088
   Memory per otcl object: 277
   Time per object: 71

 XOTcl
   Used memory: 2109440
   Memory per xotcl object: 210
   Time per object: 40

 ClassyTcl
   Used memory: 1753088
   Memory per classy tcl object: 175
   Time per object: 17

 Stooop
   Used memory: 1236992
   Memory per stooop object: 123
   Time per object: 95

Then, in a follow up posting, Gustaf writes [L3 ]

 Jean-Luc Fontaine <[email protected]> wrote in message 
 news:<[email protected]>...
 ...
 > It would be fair if all tests were conducted the same way. For example, 
 > loops for xotcl are wrapped in a main{} procedure, thus compiled, 
 > whereas the others (stooop, itcl, ...) do not benefit from such an 
 > optimization...
 > 
 > Jean-Luc


 You are right, 3 out of 10 tests of the shootout were without the proc main
 (both stoop tests and objinst.itcl). I have fixed these and updated the
 results. 

 best regards
 -gustaf
 ===========================================================================
 XOTcl
  methcall:  2.040u 0.010s 0:02.05 100.0%       0+0k 0+0io 283pf+0w
  objinst:   4.760u 0.020s 0:04.77 100.2%       0+0k 0+0io 283pf+0w
 OTcl
  methcall:  4.060u 0.000s 0:04.05 100.2%       0+0k 0+0io 330pf+0w
  objinst:   9.250u 0.010s 0:09.26 100.0%       0+0k 0+0io 330pf+0w
 itcl   
  methcall:  3.130u 0.000s 0:03.13 100.0%       0+0k 0+0io 285pf+0w
  objinst:   5.300u 0.000s 0:05.29 100.1%       0+0k 0+0io 286pf+0w
 stooop
  methcall:  6.430u 0.030s 0:06.84 94.4%        0+0k 0+0io 259pf+0w
  objinst:   13.720u 0.020s 0:14.45 95.0%       0+0k 0+0io 259pf+0w
 classytcl
  methcall:  3.040u 0.020s 0:03.05 100.3%       0+0k 0+0io 284pf+0w
  objinst:   9.030u 0.030s 0:09.67 93.6%        0+0k 0+0io 284pf+0w

19 oct 2002 : Maurice Diamantini "diam at ensta.fr": And what about adding a Snit benchmark? Snit is as nice et simple to use tcl only OO system based on delegation.

LV 2007 June 06 - it would also be interesting to add timings for the new proposed Tcl core OO TclOO.

KJN 2007 June 25 - similar tests are discussed at Tcl OO Bench

DKF 2007 Sept 30 - I report the same figures I used at the Tcl conference on the TclOO page, along with the detailed methodology used.