Version 17 of Tcl Benchmarks

Updated 2004-11-15 06:53:36

Jeffrey Hobbs: There have been discussions about the changing relative speed of Tcl over the years (primarily rotating around the addition of the byte-code compiler - faster, but then also the changes to support i18n - slower).

I created the tclbench [L1 ] application to get a better understanding of what has truly happened to performance over the years, with the forward looking view of finding the pain points and fixing them. Anyone can get tclbench from CVS [L2 ] to do relative benchmarks themselves, but below I've posted the results from a full run over the benchmark suite. All builds represent the final code of that version.

A few have noted that these numbers aren't the easiest to read overall, which I can agree with. Take a look at the Tcl Normalized Benchmarks that set 8.4 as a norm of 1.0 to compare against. For those looking for more complete version-by-version comparisons, see Tcl Extended Benchmarks.

If you've got BLT handy, then here is a little code for Plotting Tcl Benchmarks.

The speed enhancements in 8.4 are primarily achieved by work done by myself and Eric Melski at Ajuba and continued at ActiveState. Addition optimizations are also done by Miguel Sofer.

For those interested in the use of threads for concurrent processing, please see the Tcl Benchmarks with Threads.

The numbers are microseconds, but you should only look at them relative to each other. Lower is better. There is some fluctuation expected as Tcl's 'time' does wall timing, not true cpu time. In any case, these were done on a dual P3-550 with 512MB physmem SuSE 7.3 box. Dual doesn't make any difference - all interpreters were compiled static with no threads.


 TCL_INTERP: 1:8.4.4 2:8.3.5 3:8.2.3 4:8.0.5 5:7.6p2
 STARTED 2003-08-22 19:30:50 (runbench.tcl v1.15)
 Benchmark 1:8.4.4 /home/jeffh/install/linux-ix86/bin/tclsh8.4
 abbccdeeeffghkllmmmmpprrssstuvw 00:06:34 elapsed
 Benchmark 2:8.3.5 /home/jeffh/install/linux-ix86/bin/tclsh8.3
 abbccdeeeffghkllmmmmpprrssstuvw 00:10:37 elapsed
 Benchmark 3:8.2.3 /home/jeffh/install/linux-ix86/bin/tclsh8.2
 abbccdeeeffghkllmmmmpprrssstuvw 00:10:43 elapsed
 Benchmark 4:8.0.5 /home/jeffh/install/linux-ix86/bin/tclsh8.0
 abbccdeeeffghkllmmmmpprrssstuvw 00:08:09 elapsed
 Benchmark 5:7.6p2 /home/jeffh/install/linux-ix86/bin/tclsh7.6
 abbccdeeeffghkllmmmmpprrssstuvw 00:21:33 elapsed
 000 VERSIONS:                               1:8.4.4 2:8.3.5 3:8.2.3 4:8.0.5 5:7.6p2
 001 BASE64 decode 10                            438     489     468     473     -=-
 002 BASE64 decode 100                          3502    3956    3918    3937     -=-
 003 BASE64 decode 1000                        33902   38366   38159   38712     -=-
 004 BASE64 decode 10000                      337556  385472  387360  386930     -=-
 005 BASE64 decode2 10                           438     486     454     463     -=-
 006 BASE64 decode2 100                         3492    3888    3750    3853     -=-
 007 BASE64 decode2 1000                       33575   37790   36941   37666     -=-
 008 BASE64 decode2 10000                     334330  379680  373696  378894     -=-
 009 BASE64 decode3 10                           183     291     274     234     -=-
 010 BASE64 decode3 100                         1231    2231    2052    1762     -=-
 011 BASE64 decode3 1000                       11393   21709   19888   16968     -=-
 012 BASE64 decode3 10000                     113028  216822  200827  169884     -=-
 013 BASE64 encode 10                            248     356     335     388     -=-
 014 BASE64 encode 100                          1873    2974    2932    3456     -=-
 015 BASE64 encode 1000                        17861   29156   28791   33924     -=-
 016 BASE64 encode 10000                      177108  288630  288789  338796     -=-
 017 BASE64 encode2 10                           230     350     321     371     -=-
 018 BASE64 encode2 100                         1714    2875    2782    3368     -=-
 019 BASE64 encode2 1000                       16324   28118   27231   33119     -=-
 020 BASE64 encode2 10000                     163440  281054  273139  331683     -=-
 021 BASE64 encode3 10                           125     184     192     155     -=-
 022 BASE64 encode3 100                          554    1184    1268     986     -=-
 023 BASE64 encode3 1000                        4653   10934   11929    9151     -=-
 024 BASE64 encode3 10000                      45560  109177  119454   91528     -=-
 025 BIN bitset-v1 1000 chars                  14195   16373   15689   14163     -=-
 026 BIN bitset-v1 5000 chars                  68921   80448   78860   70804     -=-
 027 BIN bitset-v1 10000 chars                136925  160282  158083  142737     -=-
 028 BIN bitset-v2 1000 chars                   8512   10172    9098    8196     -=-
 029 BIN bitset-v2 5000 chars                  40393   51406   45311   40729     -=-
 030 BIN bitset-v2 10000 chars                 80696  102003   91288   82124     -=-
 031 BIN bitset-v3 1000 chars                   2073    4837    4588    4064     -=-
 032 BIN bitset-v3 5000 chars                   9258   24007   22876   20204     -=-
 033 BIN bitset-v3 10000 chars                 18470   48053   46187   40512     -=-
 034 BIN c scan, 1000b                           592     393     389     309     -=-
 035 BIN c scan, 5000b                          1996    1848    1842    1453     -=-
 036 BIN c scan, 10000b                         3723    3653    3774    2908     -=-
 037 CATCH error, complex                         37      32      31      26      31
 038 CATCH no catch used                           8       7       6       6      14
 039 CATCH return error                           37      30      28      25      30
 040 CATCH return except                           8       7       6       6      18
 041 CATCH return ok                               9       7       6       6      21
 042 DATA access in a list                       636    1980    1799    1693   40833
 043 DATA access in an array                    1070    1992    2084    1833    7193
 044 DATA create in a list                       560    2185    2172    2057    6643
 045 DATA create in an array                    1788    2748    2635    3267    8433
 046 ENC iso2022-jp, gets                        909    9537    9832     -=-     -=-
 047 ENC iso2022-jp, read                        734    9381    9670     -=-     -=-
 048 ENC iso2022-jp, read & size                 761    9425    9686     -=-     -=-
 049 ENC iso8859-2, gets                         860     624     576     -=-     -=-
 050 ENC iso8859-2, read                         695     451     444     -=-     -=-
 051 ENC iso8859-2, read & size                  713     460     452     -=-     -=-
 052 EVAL cmd and mixed lists                   1901    1414    3851    2707     561
 053 EVAL cmd eval as list                         9      10      28      26      11
 054 EVAL cmd eval as string                      27      25      30      27      12
 055 EVAL cmd eval in list obj var                10      11      29      27      15
 056 EVAL list cmd and mixed lists              1910    1426    3880    2716     563
 057 EVAL list cmd and pure lists                236     236    3872    2720     564
 058 EXPR $a != $b int                             6       6       5       5      42
 059 EXPR $a != $b str (!= len)                   15      16      14      13      61
 060 EXPR $a != $b str (== len)                   17      15      14      13      58
 061 EXPR $a == $b int                             6       6       5       5      40
 062 EXPR $a == $b str (!= len)                   14      16      14      13      58
 063 EXPR $a == $b str (== len)                   17      16      15      13      60
 064 EXPR braced                                  13      13      12      10      79
 065 EXPR fifty operands                          20      21      21      18      84
 066 EXPR incr with expr                           4       3       3       3      15
 067 EXPR incr with incr                           4       5       4       3      11
 068 EXPR inline                                  15      14      13      11      37
 069 EXPR one operand                              4       3       3       3      13
 070 EXPR ten operands                             7       6       6       5      27
 071 EXPR unbraced                               124      89      92      74      76
 072 FCOPY binary: 160K                         8145    8149    8050     -=-     -=-
 073 FCOPY encoding: 160K                      24255    8333    8244     -=-     -=-
 074 FCOPY std: 160K                            7960    8380    8379    8567    8302
 075 FILE exec interp                          12416   10989   11406   11814    5729
 076 FILE exec interp: pkg require             38841   29567   28422   16677    8232
 077 FILE exists tmpfile (obj)                    16      14      13      10       7
 078 FILE exists ~                                10     153     153      11      17
 079 FILE exists! tmpfile (obj)                   13      15      14      10       8
 080 FILE exists! tmpfile (str)                   78      18      17      13       8
 081 FILE glob  tmpdir (60 entries)              441     350     442     347     266
 082 FILE glob / all subcommands               38537   37325   37258   34010     ERR
 083 FILE glob / atime                          3261    1277    1508    1078    1455
 084 FILE glob / attributes                    23330   21686   22167   19817     ERR
 085 FILE glob / dirname                        2187     844    1104     896     915
 086 FILE glob / executable                     3243    1233    1464    1042    1091
 087 FILE glob / exists                         3227    1225    1450    1034    1077
 088 FILE glob / extension                      1072     588     829     696     698
 089 FILE glob / isdirectory                    3292    1306    1509    1085    1165
 090 FILE glob / isfile                         3283    1290    1516    1093    1168
 091 FILE glob / mtime                          3277    1293    1499    1101    1477
 092 FILE glob / owned                          3336    1354    1561    1153    1204
 093 FILE glob / readable                       3246    1223    1452    1045    1089
 094 FILE glob / rootname                       1083     611     842     708     717
 095 FILE glob / size                           3276    1277    1499    1083    1462
 096 FILE glob / tail                           1561     742     972     831     831
 097 FILE glob / writable                       3236    1224    1454    1039    1082
 098 FILE recurse / -dir                       16037   11178   11518   12343   11340
 099 FILE recurse / cd                         25642   10676   10502   11747   10568
 100 GCCont_cpb::cGCC 50                         280     582     611     510     -=-
 101 GCCont_cpb::cGCC 500                       1104    3510    3866    3129     -=-
 102 GCCont_cpb::cGCC 5000                      9338   32791   36521   29392     -=-
 103 GCCont_cpbre1::cGCC 50                      384     390     -=-     -=-     -=-
 104 GCCont_cpbre1::cGCC 500                    2490    2467     -=-     -=-     -=-
 105 GCCont_cpbre1::cGCC 5000                  23525   23231     -=-     -=-     -=-
 106 GCCont_cpbre2::cGCC 50                      318     325     -=-     -=-     -=-
 107 GCCont_cpbre2::cGCC 500                    2286    2271     -=-     -=-     -=-
 108 GCCont_cpbre2::cGCC 5000                  21973   21736     -=-     -=-     -=-
 109 GCCont_cpbrs2::cGCC 50                      115     350     343     -=-     -=-
 110 GCCont_cpbrs2::cGCC 500                     438    2600    2585     -=-     -=-
 111 GCCont_cpbrs2::cGCC 5000                   3598   25035   24972     -=-     -=-
 112 GCCont_cpbrs::cGCC1 50                      196     536     530     373     -=-
 113 GCCont_cpbrs::cGCC1 500                     529    2919    2904     709     -=-
 114 GCCont_cpbrs::cGCC1 5000                   3831   26505   26469    3947     -=-
 115 GCCont_cpbrs::cGCC2 50                      163     582     573     356     -=-
 116 GCCont_cpbrs::cGCC2 500                     476    3040    3025     643     -=-
 117 GCCont_cpbrs::cGCC2 5000                   3559   27410   27350    3307     -=-
 118 GCCont_cpbrs_trap::cGCC 50                  367     377     375     229     -=-
 119 GCCont_cpbrs_trap::cGCC 500                2420    2484    2473    1196     -=-
 120 GCCont_cpbrs_trap::cGCC 5000              22936   23416   23371   10843     -=-
 121 GCCont_expr::cGCC 50                        268     250     249     -=-     -=-
 122 GCCont_expr::cGCC 500                      3077    3212    3200     -=-     -=-
 123 GCCont_expr::cGCC 5000                   399078  425460  395255     -=-     -=-
 124 GCCont_i::cGCC1 50                          461     471     476     423     -=-
 125 GCCont_i::cGCC1 500                        4101    4200    4372    3981     -=-
 126 GCCont_i::cGCC1 5000                      39675   41870   43676   39598     -=-
 127 GCCont_i::cGCC2 50                          144     217     244     198     -=-
 128 GCCont_i::cGCC2 500                        1023    1698    2062    1693     -=-
 129 GCCont_i::cGCC2 5000                      10072   16539   20241   16743     -=-
 130 GCCont_i::cGCC3 50                          132     207     233     187     -=-
 131 GCCont_i::cGCC3 500                         876    1582    1932    1566     -=-
 132 GCCont_i::cGCC3 5000                       8052   15213   18934   15549     -=-
 133 GCCont_r1::cGCC 50                          624     711     703     572     -=-
 134 GCCont_r1::cGCC 500                        6014    6777    6810    5567     -=-
 135 GCCont_r1::cGCC 5000                      59853   67786   67047   55617     -=-
 136 GCCont_r2::cGCC 50                          553     508     540     435     -=-
 137 GCCont_r2::cGCC 500                        5110    4586    4960    4087     -=-
 138 GCCont_r2::cGCC 5000                      50842   45508   49886   40986     -=-
 139 GCCont_r3::cGCC 50                          550     519     535     444     -=-
 140 GCCont_r3::cGCC 500                        5118    4688    5031    4046     -=-
 141 GCCont_r3::cGCC 5000                      51010   46694   50344   40307     -=-
 142 GCCont_rsf1::cGCC 50                        189     241     289     -=-     -=-
 143 GCCont_rsf1::cGCC 500                      1064    1596    2202     -=-     -=-
 144 GCCont_rsf1::cGCC 5000                     9794   15076   21138     -=-     -=-
 145 GCCont_rsf2::cGCC1 50                       136     181     200     -=-     -=-
 146 GCCont_rsf2::cGCC1 500                      618    1050    1294     -=-     -=-
 147 GCCont_rsf2::cGCC1 5000                    5340    9691   12250     -=-     -=-
 148 GCCont_rsf2::cGCC2 50                       116     147     166     -=-     -=-
 149 GCCont_rsf2::cGCC2 500                      587     955    1196     -=-     -=-
 150 GCCont_rsf2::cGCC2 5000                    5173    8983   11574     -=-     -=-
 151 GCCont_rsf3::cGCC 50                        121     146     167     -=-     -=-
 152 GCCont_rsf3::cGCC 500                       588     957    1201     -=-     -=-
 153 GCCont_rsf3::cGCC 5000                     5174    8981   11566     -=-     -=-
 154 GCCont_turing::cGCC 50                       98     143     138     -=-     -=-
 155 GCCont_turing::cGCC 500                     406     835     832     -=-     -=-
 156 GCCont_turing::cGCC 5000                   3465    8073    8024     -=-     -=-
 157 HEAPSORT size 10                            283     372     365    4475    2682
 158 HEAPSORT size 50                           2298    2928    2885   26359   22505
 159 HEAPSORT size 100                          5496    7008    6968   55549   53420
 160 HEAPSORT2 size 10                           243     -=-     -=-     -=-     -=-
 161 HEAPSORT2 size 50                          1919     -=-     -=-     -=-     -=-
 162 HEAPSORT2 size 100                         4521     -=-     -=-     -=-     -=-
 163 IF 1/0 check                                  5       8       6       6      27
 164 IF else true al                              15      15      14      12      44
 165 IF else true numeric                          7       8       7       7      38
 166 IF elseif true al                            11      15      14      12      43
 167 IF elseif true numeric                        7       8       8       7      39
 168 IF if false al/al                            10      10       9       8      33
 169 IF if false al/num                            9       9       8       7      53
 170 IF if false num/num                           6       7       6       6      34
 171 IF if true al                                 6      10      10       8      33
 172 IF if true al/al                              6      11      10       8      33
 173 IF if true num/num                            6       7       6       6      32
 174 IF if true numeric                            6       6       6       5      30
 175 IF multi 1st true                             6       6       6       5      49
 176 IF multi 2nd true                             7       8       7       7      53
 177 IF multi 9th true                            12      16      15      14      89
 178 IF multi default true                        12      16      15      14      91
 179 KLIST shuffle0 llength 1                     50      76      72      67    8.0+
 180 KLIST shuffle0 llength 10                   117     225     212     197    8.0+
 181 KLIST shuffle0 llength 100                  927    1804    1754    1565    8.0+
 182 KLIST shuffle0 llength 1000               10936   19360   19029   16967    8.0+
 183 KLIST shuffle0 llength 10000             149713  232355  236302  204873     -=-
 184 KLIST shuffle1-s llength 1                   45      48      45      34     121
 185 KLIST shuffle1-s llength 10                 201     218     213     209     902
 186 KLIST shuffle1-s llength 100               2794    2834    2640    2284   15724
 187 KLIST shuffle1-s llength 1000            270205  275074  242747  238272  934768
 188 KLIST shuffle1a llength 1                    53      57      52      40     153
 189 KLIST shuffle1a llength 10                  220     236     245     233    1191
 190 KLIST shuffle1a llength 100                2086    2185    2360    2160   19779
 191 KLIST shuffle1a llength 1000              20948   22084   23499   21727 1151337
 192 KLIST shuffle1a llength 10000            208678  221935  237250  220128     -=-
 193 KLIST shuffle2 llength 1                     49      66      61      65     152
 194 KLIST shuffle2 llength 10                   202     284     267     350     987
 195 KLIST shuffle2 llength 100                 1888    2513    2394    3159    9379
 196 KLIST shuffle2 llength 1000               19259   25411   24289   31443   93842
 197 KLIST shuffle2 llength 10000             209106  274261  259984  340913     -=-
 198 KLIST shuffle3 llength 1                     44      58      54      45     120
 199 KLIST shuffle3 llength 10                   177     228     238     232     883
 200 KLIST shuffle3 llength 100                 1629    2032    2172    1971   10474
 201 KLIST shuffle3 llength 1000               17421   21446   22816   20634  347479
 202 KLIST shuffle3 llength 10000             393545  439816  462088  431920     -=-
 203 KLIST shuffle4 llength 1                     46      60      57      46     131
 204 KLIST shuffle4 llength 10                   186     249     258     248    1002
 205 KLIST shuffle4 llength 100                 1685    2234    2340    2110   14108
 206 KLIST shuffle4 llength 1000               16847   21989   23124   20760  664685
 207 KLIST shuffle4 llength 10000             168300  220308  235370  209809     -=-
 208 KLIST shuffle5-s llength 1                   19      22      21      18      90
 209 KLIST shuffle5-s llength 10                 131     143     130     108     637
 210 KLIST shuffle5-s llength 100               1530    1598    1362    1090    7225
 211 KLIST shuffle5-s llength 1000             77401   78097   61650   58257  207832
 212 KLIST shuffle5a llength 1                    22      26      24      20     100
 213 KLIST shuffle5a llength 10                  138     146     132     113     780
 214 KLIST shuffle5a llength 100                1242    1302    1171    1018    8944
 215 KLIST shuffle5a llength 1000              13771   14070   12902   12167  268812
 216 KLIST shuffle5a llength 10000            353043  358210  344532  342319     -=-
 217 KLIST shuffle6 llength 1                      6     -=-     -=-     -=-     -=-
 218 KLIST shuffle6 llength 10                    59     -=-     -=-     -=-     -=-
 219 KLIST shuffle6 llength 100                  499     -=-     -=-     -=-     -=-
 220 KLIST shuffle6 llength 1000                5026     -=-     -=-     -=-     -=-
 221 KLIST shuffle6 llength 10000              51532     -=-     -=-     -=-     -=-
 222 LIST append to list                           7      17      14      13      12
 223 LIST concat APPEND 2x10                      48      49      46      37      22
 224 LIST concat APPEND 2x100                    255     255     253     204      66
 225 LIST concat APPEND 2x1000                  2353    2337    2371    1932     462
 226 LIST concat APPEND 2x10000                26173   25887   26646   23694    4857
 227 LIST concat CONCAT 2x10                      16      16      32      26      26
 228 LIST concat CONCAT 2x100                     24      25     208     165      87
 229 LIST concat CONCAT 2x1000                   120     120    2007    1637     638
 230 LIST concat CONCAT 2x10000                 1078    1073   21583   19173    6637
 231 LIST concat EVAL/LAPPEND 2x10                27      27      49      43      34
 232 LIST concat EVAL/LAPPEND 2x100               38      40     124     105     136
 233 LIST concat EVAL/LAPPEND 2x1000             156     157     871     725    1084
 234 LIST concat EVAL/LAPPEND 2x10000           1746    1759    9276    7113   11076
 235 LIST concat FOREACH/LAPPEND 2x10             26      50      48      42      58
 236 LIST concat FOREACH/LAPPEND 2x100           108     339     318     293     366
 237 LIST concat FOREACH/LAPPEND 2x1000          942    3190    3073    2802    3380
 238 LIST concat FOREACH/LAPPEND 2x10000        9634   32239   30959   28479   34163
 239 LIST concat SET 2x10                         34      34      31      26      23
 240 LIST concat SET 2x100                       207     211     208     167      71
 241 LIST concat SET 2x1000                     2011    1992    2008    1637     510
 242 LIST concat SET 2x10000                   21438   21538   22021   19590    5352
 243 LIST exact search, first item                 9       7       6       6     431
 244 LIST exact search, last item                 38      33      31      28     448
 245 LIST exact search, middle item               17      14      13      11     439
 246 LIST exact search, non-item                 100      92      91      86     471
 247 LIST exact search, typed item                31      32      31      29     448
 248 LIST exact search, untyped item              38      32      31      28     449
 249 LIST index first element                      7       6       5       5     143
 250 LIST index last element                       7       6       5       5     176
 251 LIST index middle element                     7       6       5       5     158
 252 LIST insert an item at "end"                117     115     113     111     383
 253 LIST insert an item at middle               123     122     119     119     238
 254 LIST insert an item at start                124     123     120     119     220
 255 LIST iterate list                          1451    3883    3636    3430  353249
 256 LIST join list                              626     614     614     389    1123
 257 LIST large, early range                      16      15      15      11     174
 258 LIST large, late range                       16      14      13      11     182
 259 LIST length, pure list                        6       7       6       5     501
 260 LIST list                                    18      24      22      21      60
 261 LIST lset foreach  l                       2027    =8.4    =8.4    =8.4    =8.4
 262 LIST lset foreach  list                    2024    =8.4    =8.4    =8.4    =8.4
 263 LIST lset foreach ""s l                     453    =8.4    =8.4    =8.4    =8.4
 264 LIST lset foreach ""s list                  452    =8.4    =8.4    =8.4    =8.4
 265 LIST regexp search, first item               20      18      16       8     435
 266 LIST regexp search, last item               961     989     987     204     615
 267 LIST regexp search, non-item               2009    2090    2085     335     730
 268 LIST remove first element                   121     123     119     118     189
 269 LIST remove in mixed list                   140     133    1099     130     235
 270 LIST remove last element                    120     121     120     116     253
 271 LIST remove middle element                  120     122     119     117     235
 272 LIST replace first el with multiple         125     125     121     121     232
 273 LIST replace first element                  116     115     114     112     222
 274 LIST replace in mixed list                  133     129    1095     124     239
 275 LIST replace last el with multiple          116     117     116     114     397
 276 LIST replace last element                   115     116     114     112     388
 277 LIST replace middle el with multiple        120     122     119     119     321
 278 LIST replace middle element                 116     116     114     112     311
 279 LIST replace range                          115     114     113     111     282
 280 LIST small, early range                      10      10       8       7     148
 281 LIST small, late range                       10      10       8       7     175
 282 LIST sort                                  1582    1598    1555    1508    1551
 283 LIST sorted search, first item               10       7       6       6     431
 284 LIST sorted search, last item                10      32      32      29     448
 285 LIST sorted search, middle item              10      14      13      11     438
 286 LIST sorted search, non-item                 10      92      91      86     470
 287 LIST sorted search, typed item               10      33      31      29     448
 288 LIST typed sort                            1384    1379    1334    1082    5480
 289 LOOP for (to 1000)                          746    1607    1564    1527   12031
 290 LOOP for, iterate list                     1244    2921    2714    2526  147498
 291 LOOP for, iterate string                   2008    4372    4296    3448   37437
 292 LOOP foreach, iterate list                  682    1188    1171    1091    3323
 293 LOOP foreach, iterate string                900    1398    2141    1857    3073
 294 LOOP while (to 1000)                        742    1607    1566    1527   12187
 295 LOOP while 1 (to 1000)                      708    1565    1546    1446   13382
 296 MAP ([chars])-case regsub                   184     177     179      34      54
 297 MAP http mapReply                        170848  165123  164578  153706   22485
 298 MAP regsub -nocase, no match               1884    1656    1648     933    1237
 299 MAP regsub 1 val                            681    2687    2676     435     865
 300 MAP regsub 1 val -nocase                   1446    2686    2672     595    1073
 301 MAP regsub 2 val                           1834   11863   11804    1098    1892
 302 MAP regsub 2 val -nocase                   3225   11850   11806    1435    2282
 303 MAP regsub 3 val                           2646   16162   16191    1498    2493
 304 MAP regsub 3 val -nocase                   4664   16164   16176    1983    3027
 305 MAP regsub 4 val                           3448   20398   20447    1878    3080
 306 MAP regsub 4 val -nocase                   6028   20402   20440    2511    3762
 307 MAP regsub short                             31     111     110      26      55
 308 MAP regsub, no match                        307    1656    1650     602     801
 309 MAP string -nocase, no match               2389   11762   11942   nomap   nomap
 310 MAP string 1 val                            636    4094    4145   nomap   nomap
 311 MAP string 1 val -nocase                   1336    6435    6431   nomap   nomap
 312 MAP string 2 val                           1284    4991    5025   nomap   nomap
 313 MAP string 2 val -nocase                   2540    9318    9284   nomap   nomap
 314 MAP string 3 val                           1538    5948    6004   nomap   nomap
 315 MAP string 3 val -nocase                   3266   12145   12261   nomap   nomap
 316 MAP string 4 val                           1885    6443    6429   nomap   nomap
 317 MAP string 4 val -nocase                   4000   14072   14053   nomap   nomap
 318 MAP string short                             25      23      21   nomap   nomap
 319 MAP string, no match                        778    5945    5994   nomap   nomap
 320 MAP |-case regsub                            90      85      85      26      40
 321 MAP |-case strmap                            24      26      25   nomap   nomap
 322 MATRIX mult 5x5                             360     720     699     593    3513
 323 MATRIX mult 10x10                          2305    4404    4289    3595   26123
 324 MATRIX mult 15x15                          7325   13676   13414   11236   91763
 325 MATRIX transposition-0                     3181   11013   10519    8595   28379
 326 MATRIX transposition-1                     2340    7294    6612    6033  108821
 327 MD5 msg len 10                             1466    1442    1332    1309     -=-
 328 MD5 msg len 100                            2556    2546    2343    2357     -=-
 329 MD5 msg len 1000                          17933   18109   16502   16745     -=-
 330 MD5 msg len 10000                        173832  174102  159596  162380     -=-
 331 MD5-2 msg len 10                            608     589     568     491     -=-
 332 MD5-2 msg len 100                           895     888     866     762     -=-
 333 MD5-2 msg len 1000                         4903    5063    5027    4497     -=-
 334 MD5-2 msg len 10000                       45280   47095   46996   41979     -=-
 335 MTHD array stored proc call                   5       5       4       4     -=-
 336 MTHD call absolute                           11      16      12      13     -=-
 337 MTHD call relative                           16      17      13      12     -=-
 338 MTHD direct ns proc call                      4       3       3       3     -=-
 339 MTHD imported ns proc call                    4       3       3       3     -=-
 340 MTHD indirect proc eval                      15      14      31      30     -=-
 341 MTHD indirect proc eval #2                   25      25      30      29     -=-
 342 MTHD inline call                              2       2       1       1     -=-
 343 MTHD interp alias proc call                   5      10       9       4     -=-
 344 MTHD ns lookup call                          49      50      66      55     -=-
 345 MTHD switch method call                      22      21      40      39     -=-
 346 PARSE html form upload (7817)             10968   12036   11561   10986     -=-
 347 PARSE html form upload (973817)         1326215 1465251 1419800 1343516     -=-
 348 PROC do-nothing, no args                      3       3      14       2       1
 349 PROC do-nothing, one arg                      4       3       3       2       4
 350 PROC empty, no args                           1       3      15       2       4
 351 PROC empty, use args                          1       4       4       3       6
 352 PROC explicit return                          3       4       3       3       6
 353 PROC explicit return (2)                      4       4       3       3       5
 354 PROC explicit return (3)                      4       4       3       3       5
 355 PROC heavily commented                        3       3       2       2     194
 356 PROC implicit return                          4       3       3       3       8
 357 PROC implicit return (2)                      4       3       3       3       6
 358 PROC implicit return (3)                      4       3       3       2       4
 359 PROC local links with global                588     661     655     639    1575
 360 PROC local links with upvar                 523     591     589     576    1585
 361 PROC local links with variable              505     561     563     340    1557
 362 RE 1-char long-end                           48      45      45     578     623
 363 RE 1-char long-end catching                  84      98      96     605     650
 364 RE 1-char long-middle                        33      30      29     294     335
 365 RE 1-char long-middle catching               70      83      82     322     362
 366 RE 1-char long-start                         18      16      14      11      48
 367 RE 1-char long-start catching                54      68      66      39      75
 368 RE 1-char short                              18      16      14      11      13
 369 RE 1-char short catching                     54      66      65      38      39
 370 RE basic                                     16      14      12      11      14
 371 RE basic catching                            60      72      71      38      37
 372 RE c-comment long                            59      57      56      85     124
 373 RE c-comment long catching                  176     190     187     121     196
 374 RE c-comment long nomatch                    80      79      79      17      90
 375 RE c-comment long nomatch catching           83      79      82      21      99
 376 RE c-comment long pmatch                     91      88      86     561     633
 377 RE c-comment long pmatch catching            93      90      87     565     642
 378 RE c-comment many *s                         93      91      89     159     236
 379 RE c-comment many *s catching               281     296     296     205     358
 380 RE c-comment nomatch                         23      21      20       9      14
 381 RE c-comment nomatch catching                25      21      20      12      21
 382 RE c-comment simple                          37      35      32      21      24
 383 RE c-comment simple catching                132     143     143      50      52
 384 RE count all matches                        101      98     284     240     497
 385 RE extract all matches                      120     115     342     287     652
 386 RE literal regexp                            25      23      20      15      15
 387 RE n-char long-end                           48      46      46     663     703
 388 RE n-char long-end catching                  94     108     106     693     729
 389 RE n-char long-middle                        33      31      30     337     375
 390 RE n-char long-middle catching               79      92      91     365     403
 391 RE n-char long-start                         18      17      14      11      50
 392 RE n-char long-start catching                63      77      74      39      77
 393 RE n-char short                              18      16      14      11      13
 394 RE n-char short catching                     62      76      74      39      39
 395 RE static anchored match                      4      17      16       6       9
 396 RE static anchored nomatch                    4       9       7       6       9
 397 RE static l-anchored match                    4      13      11       6       9
 398 RE static l-anchored nomatch                  4       8       7       6       8
 399 RE static long match                         15      35      33      23      59
 400 RE static long nomatch                       20      48      47      25      61
 401 RE static r-anchored match                    5      15      14       7       9
 402 RE static r-anchored nomatch                  5      12      11       6       9
 403 RE static short match                         5      15      14       6       8
 404 RE static short nomatch                       5      10       8       5       7
 405 RE var-based regexp                          26      24      22      16      19
 406 READ 595K, gets                          174582  269962  217264  116974  215192
 407 READ 595K, read                           35843   56901   56722  243304  244472
 408 READ 595K, read & size                    35803   56985   56966   18317  247959
 409 READ 3050b, gets                            949    1460    1184     665    1218
 410 READ 3050b, read                            268     346     342     158     261
 411 READ 3050b, read & size                     280     355     352     162     274
 412 READ bin 595K, gets                      174164  279865  225164  116431  215746
 413 READ bin 595K, read                       12589   12800   12754  237420  245574
 414 READ bin 595K, read & size                12622   12680   12738   17990  246801
 415 READ bin 3050b, gets                        998    1534    1259     683    1224
 416 READ bin 3050b, read                        155     151     145     171     271
 417 READ bin 3050b, read & size                 168     161     155     179     280
 418 SHA sha1 msg len 10                        3267    3795    3572    3878     -=-
 419 SHA sha1 msg len 100                       5948    7028    6648    7292     -=-
 420 SHA sha1 msg len 1000                     43713   52730   49660   55319     -=-
 421 SHA sha1 msg len 10000                   425759  518456  489715  537683     -=-
 422 SHA sha1DF msg len 10                      1241    2130    2012    1770     -=-
 423 SHA sha1DF msg len 100                     2340    4108    3901    3432     -=-
 424 SHA sha1DF msg len 1000                   17715   31840   30073   26551     -=-
 425 SHA sha1DF msg len 10000                 172613  312294  296045  259741     -=-
 426 SPLIT iter, 4000 uchars                    3858    5857    8609    7440   12234
 427 SPLIT iter, 4010 chars                     3848    5814    8572    7465   12219
 428 SPLIT iter, rand 100 c                      247     288     230     197     -=-
 429 SPLIT iter, rand 1000 c                    1417    1883    2178    1831     -=-
 430 SPLIT iter, rand 10000 c                  10282   15317   21879   18851     -=-
 431 SPLIT on 'c', 4000 uchars                   238     618     616     293    1034
 432 SPLIT on 'c', 4010 chars                    226     583     583     294     995
 433 SPLIT on 'cz', 4000 uchars                  613    1019    1020     522    1382
 434 SPLIT on 'cz', 4010 chars                   584     974     976     521    1345
 435 SPLIT on 'c��»', 4000 uchars                  757    1064    1065     519    1364
 436 SPLIT on 'c��»', 4010 chars                   535     792     789     323    1022
 437 SPLIT, 4000 uchars                         1228    1190    3873    3021    1058
 438 SPLIT, 4010 chars                          1165    1150    3887    3059    1031
 439 SPLIT, rand 100 c                           175     162     109      84     -=-
 440 SPLIT, rand 1000 c                          762     715    1014     779     -=-
 441 SPLIT, rand 10000 c                        3711    3477   10111    7843     -=-
 442 STR append                                   55      38      34      28     247
 443 STR append (1KB + 1KB)                       20      32      29      24     148
 444 STR append (1MB + (1b + 1K + 1b) * 100)    9030   17647   17591   17479  120367
 445 STR append (1MB + 1KB * 20)                8041   16667   16734   16638  116704
 446 STR append (1MB + 1KB * 1000)             15842   26112   25944   25372  160328
 447 STR append (1MB + 1KB)                     7875   16435   16540   16522  115973
 448 STR append (1MB + 1MB * 3)                32681   41340   41158   41280  338748
 449 STR append (1MB + 1MB * 5)                40874   81966   81753   81966  440533
 450 STR append (1MB + 2b * 1000)               9030   20254   20044   19880  121968
 451 STR append (10KB + 1KB)                      75      88      85      80     646
 452 STR first (failure)                          45      35      33      32     188
 453 STR first (failure) utf                      45     133     129      31     189
 454 STR first (success)                           9       9       7       6     151
 455 STR first (success) utf                       9      10       8       6     151
 456 STR first (total failure)                    38      17      15      15     179
 457 STR first (total failure) utf                38      18      16      15     179
 458 STR index 0                                   9      10       9       7     176
 459 STR index 100                                 9      10       9       7     177
 460 STR index 500                                 9      10       9       7     176
 461 STR info locals match                       395     509     504     478    1422
 462 STR last (failure)                           52      64      62      49     188
 463 STR last (success)                            9     132     131       6     191
 464 STR last (total failure)                     45      51      50      35     179
 465 STR length (==4010)                           6       7       6       5     176
 466 STR length growing (1000)                  1246    3256    3145    2911   10356
 467 STR length growing uc (1000)               1243    3261    3143    2914   10948
 468 STR length of a LIST                          5       6       5       5     171
 469 STR length static str                         4       6       6       5      20
 470 STR match, complex (failure 2)           114691 1079676 1079658  453449  451845
 471 STR match, complex (failure)                 73     626     626     263     403
 472 STR match, complex (success early)            7      13      12       8     148
 473 STR match, complex (success late)            94     637     636     267     407
 474 STR match, complex (total failure)           48     615     615     260     400
 475 STR match, exact (failure)                    4       5       4       4       7
 476 STR match, exact (success)                    4       6       5       4       7
 477 STR match, exact -nocase (failure)            4       5       5     ERR     ERR
 478 STR match, exact -nocase (success)            6       8       7     ERR     ERR
 479 STR match, simple (failure)                   4       5       4       4      10
 480 STR match, simple (success)                   4       5       4       4       9
 481 STR range, index 100..200 of 4010            12      11       9       7     181
 482 STR repeat, 4010 chars * 10                  91      88     178     218    1792
 483 STR repeat, 4010 chars * 100               1544    1581    3231    3760   15377
 484 STR repeat, abcdefghij * 10                   9       8      11      43     164
 485 STR repeat, abcdefghij * 100                 28      28      49     346    1343
 486 STR repeat, abcdefghij * 1000               218     214     406    3357   13369
 487 STR replace, equal replacement               44     178     175      26     401
 488 STR replace, longer replacement              44     178     175      26     401
 489 STR replace, no replacement                  42     177     174      26     400
 490 STR reverse iter/append, 10 c                47      84      83      64     176
 491 STR reverse iter/append, 10 uc               48      83      81      64     176
 492 STR reverse iter/append, 100 c              284     654     665     509    1641
 493 STR reverse iter/append, 100 uc             300     653     638     508    1639
 494 STR reverse iter/append, 400 c             1078    2584    2586    1961    9774
 495 STR reverse iter/append, 400 uc            1132    2540    2490    1960    9768
 496 STR reverse iter/set, 10 c                   45      67      63      52     181
 497 STR reverse iter/set, 10 uc                  45      64      63      52     182
 498 STR reverse iter/set, 100 c                 358     540     534     442    1817
 499 STR reverse iter/set, 100 uc                374     540     536     441    1798
 500 STR reverse iter/set, 400 c                1485    2270    2181    1782   11782
 501 STR reverse iter/set, 400 uc               1560    2176    2196    1797   11787
 502 STR reverse recursive, 10 c                 122     152     140     106     328
 503 STR reverse recursive, 10 uc                120     151     140     106     328
 504 STR reverse recursive, 100 c               1210    1514    1379    1077    3474
 505 STR reverse recursive, 100 uc              1190    1929    1803    1079    3466
 506 STR reverse recursive, 400 c               5060    6241    5853    4601    8.0+
 507 STR reverse recursive, 400 uc              5186   14413   13845    4602    8.0+
 508 STR str $a eq $b                              9      16      15      14      53
 509 STR str $a eq $b (same obj)                   9      16      15      14      51
 510 STR str $a equal ""                           6      11      11       8      64
 511 STR str $a ne $b                             10      17      15      15      49
 512 STR str $a ne $b (same obj)                   9      17      15      14      50
 513 STR str num == ""                             6       8       9       8      64
 514 STR string compare                            9      13      11      11      21
 515 STR string compare ""                         9      11      11      12      39
 516 STR string compare long                     128     132     129     129     661
 517 STR string compare long (same obj)            9     130     129     129     664
 518 STR string compare mixed long               190     137     134     133     663
 519 STR string compare uni long                 135     151     149     129     660
 520 STR string equal ""                           8      11      11      12      39
 521 STR string equal long (!= len)               15     143     141     139     723
 522 STR string equal long (== len)              103     135     133     132     720
 523 STR string equal long (same obj)             10     133     132     132     724
 524 STR string equal mixed long                   9     135     133     132     721
 525 STR string equal uni long                   116     154     153     132     721
 526 STR/LIST length, obj shimmer               1126    1228    1213       8     653
 527 SWITCH 1st true                              18      17      16      14      47
 528 SWITCH 2nd true                              19      17      15      14      47
 529 SWITCH 9th true                              21      19      17      16      48
 530 SWITCH default true                          21      20      18      17      49
 531 TRACE all set (rwu)                          18      16      15      14      24
 532 TRACE no trace set                           18      16      15      14      24
 533 TRACE read                                   18      16      15      14      23
 534 TRACE unset                                  19      16      14      14      23
 535 TRACE write                                  19      16      14      14      24
 536 UNSET catch var !exist                       41      36      35      31      21
 537 UNSET catch var exists                        6       6       5       5      12
 538 UNSET info check var !exist                   7       6       5       5      13
 539 UNSET info check var exists                   9       8       7       7      15
 540 UNSET nocomplain var !exist                   6      36      34      30      22
 541 UNSET nocomplain var exists                   6       6       5       5      13
 542 UNSET var exists                              5       5       4       4       7
 543 VAR 'array set' of 100 elems                 98     155     155     140     243
 544 VAR 100 'set's in array                      72      80      78      81     231
 545 VAR access global                            10      15      14      13      21
 546 VAR access local proc arg                     5       5       5       5      19
 547 VAR access locally set                        5       5       5       5      18
 548 VAR access upvar                             13      18      17      15      22
 549 VAR mset                                     11      16      14      14      55
 550 VAR mset (foreach)                            7       8       7       6      30
 551 VAR ref absolute                            231     337     330     268    8.0+
 552 VAR ref local                                32      68      66      61    8.0+
 553 VAR ref variable                             39     165     161     139    8.0+
 554 VAR set array element                         9       7       6       6      10
 555 VAR set scalar                                4       4       3       3       8
 556 WORDCOUNT wc1                              2998    3120    2975    1133    1840
 557 WORDCOUNT wc2                               617    1741    1744     666    1016
 558 WORDCOUNT wc3                               558    1649    1659     592     732
 558 BENCHMARKS                              1:8.4.4 2:8.3.5 3:8.2.3 4:8.0.5 5:7.6p2
 FINISHED 2003-08-22 20:28:26

JH: The numbers below by Kevin are for a previous set of numbers, and need updating (note only 8.4a3 is mentioned). The only thing likely to change though is to show that 8.4 is pulling ahead in performance.

Kevin Kenny: For those that insist on a single figure of merit, I took these numbers, normalized them to a scale of 8.4a3 == 1.0, and then took the harmonic mean of all benchmarks.


    Version   Relative Speed   Comments

     7.6p2         0.125       The last version without bytecode
                               compilation

     8.0.5         0.736       Bytecode compilation initially sped
                               things up by a factor of about 6.

     8.2.3         0.600       The cost of internationalization was
                               that things got about 20% slower.

     8.3.1         0.606       Not much change here....

     8.4a3         1.000       The reference against which the
                               others were measured.  Many more
                               operations are bytecoded, which
                               gains about 50% in speed.

As with all benchmarks, take these numbers with a spoonful of salt!


TCL benchmarks compared with other languages

RA2

- See also: http://shootout.alioth.debian.org/benchmark.php?test=all&lang=tcl&sort=cpu

- Benchmarks for all programming languages: http://shootout.alioth.debian.org/


Category Performance