The '''Non'''-'''Recursive'''-'''Engine''', by [Miguel Sofer], is a component of [The major new features of Tcl/Tk 8.6%|%Tcl 8.6] and above which provides a mechanism for stackless evaluation of Tcl scripts. ** See Also ** [NRE: the non-recursive engine in Tcl 8.6]: [NRE: Coroutines in 8.6]: [concurrency concepts]: [nredebugging]: a [GSoC 2011 Executed Projects%|%GSoC 2011 project] to implement [gdb] commands to access the internal call stack of Tcl [http://chiselapp.com/user/krzykwas/repository/nredebug1/timeline%|%nredebug]: obtain readable NRE information with gdb ** History ** [Miguel Sofer] began work on the NRE in 2008. It was announced via the TCLCORE mailing list message "[http://code.activestate.com/lists/tcl-core/5957/%|%Announce: Experimental NRE (non-recursive engine)]", 2008-03-02. NRE's first implementation can be found in the mod-core-8-3-4 branch of the [The Tcl Core%|%Tcl Core] repository. NRE was included in the 8.6a2 release. Tclkits (i.e. single-file executables) containing Tcl 8.6a1 and NRE are archived at: * Windows - http://www.tcl.tk/starkits/nrekit.exe and http://www.tcl.tk/starkits/nrekitsh.exe * OSX (universal) - http://www.tcl.tk/starkits/nrekit-osx-universal.gz * Linux (ix86) - http://www.tcl.tk/starkits/nrekit-linux-ix86.gz Development versions of NRE included the commands [::tcl::unsupported::tailcall] and [atProcExit], with examples in tests/unsupported.test''. ** Description ** NRE was created to reduce usage of the [C] stack by Tcl when evaluating procedures, which made deep recursion problematic. NRE reduces the C stack consumption very noticeably, essentially making the recursion limit infinite (recursion depth is bounded by the heap not the stack). It also implements true [tailcall%|%tailcalls], making the recursion depth bound by things like the supply of electricity and/or the lifetime of the hardware. ** Demonstration ** Showing off - on a 256kB stack (128kB crashes on startup): ======none mig@uh:/home/CVS/fossil/tcl/unix$ ulimit -s 256 mig@uh:/home/CVS/fossil/tcl/unix$ ulimit -S 256 mig@uh:/home/CVS/fossil/tcl/unix$ ./tclsh % proc a i {if {[incr i] > 50000} {return $i}; a $i} % a 0 too many nested evaluations (infinite loop?) % interp recursionlimit {} 10000000 10000000 % a 0 50001 ====== ** Performance ** In the following report, version 8.6.0 features NRE: ======none 000 VERSIONS: 1:8.6.0 2:8.5.7 3:8.4.19 001 ARRAY format genKeys 50 69.60 97.51 47.78 002 ARRAY format genKeys 500 773.45 1521.31 489.86 003 ARRAY makeHash 500 50 33074.56 49475.31 20046.36 004 ascii85 strlen 2690 2489.90 3033.66 3023.10 005 ascii85 strlen 269000 260930.8 528909.4 279435.7 006 BASE64 decode 10 33.73 66.80 42.87 007 BASE64 decode 100 259.03 277.59 367.79 008 BASE64 decode 1000 3710.93 2718.70 4565.41 009 BASE64 decode 10000 33488.20 26425.52 40416.10 010 BASE64 decode2 10 29.33 79.52 38.32 011 BASE64 decode2 100 254.18 315.14 341.20 012 BASE64 decode2 1000 3325.54 2652.13 3512.48 013 BASE64 decode2 10000 26273.45 24554.86 35751.30 014 BASE64 decode3 10 22.43 29.28 25.36 015 BASE64 decode3 100 129.52 147.36 156.78 016 BASE64 decode3 1000 1711.25 1514.78 1487.79 017 BASE64 decode3 10000 13734.26 20367.06 17936.80 018 BASE64 encode 10 23.70 39.57 29.23 019 BASE64 encode 100 157.88 218.69 209.30 020 BASE64 encode 1000 1820.57 2764.16 2438.73 021 BASE64 encode 10000 18397.27 21089.76 20889.70 022 BASE64 encode2 10 24.94 35.64 23.43 023 BASE64 encode2 100 166.55 145.98 219.95 024 BASE64 encode2 1000 1401.06 1821.84 1988.63 025 BASE64 encode2 10000 13027.94 14227.55 22047.50 026 BASE64 encode3 10 14.33 28.15 15.05 027 BASE64 encode3 100 74.17 71.34 115.75 028 BASE64 encode3 1000 1346.17 597.73 889.84 029 BASE64 encode3 10000 4936.69 5890.60 8265.54 030 BIN bitset-v1 1000 chars 2321.96 1232.95 1549.13 031 BIN bitset-v1 5000 chars 11664.10 5850.85 8150.95 032 BIN bitset-v1 10000 chars 22423.03 13292.54 15154.27 033 BIN bitset-v2 1000 chars 1384.77 768.46 865.74 034 BIN bitset-v2 5000 chars 6224.50 4308.98 3785.93 035 BIN bitset-v2 10000 chars 13232.74 8230.62 9572.55 036 BIN bitset-v3 1000 chars 477.19 418.38 407.31 037 BIN bitset-v3 5000 chars 2166.51 1422.15 1403.59 038 BIN bitset-v3 10000 chars 5843.05 3095.32 2976.93 039 BIN c scan, 1000b 97.66 90.29 107.36 040 BIN c scan, 5000b 317.60 339.17 405.12 041 BIN c scan, 10000b 577.90 733.22 644.74 042 BIN chars, 10000b 4610.57 3292.15 2862.88 043 BIN rand string 100b 194.83 125.61 100.80 044 BIN rand string 5000b 11211.29 6154.74 5080.53 045 BIN rand2 string 100b 93.64 66.58 45.08 046 BIN rand2 string 5000b 4156.36 3413.26 2014.34 047 BIN u char, 10000b 848.64 663.60 -=- 048 CATCH error, complex 5.29 8.33 3.28 049 CATCH no catch used 1.59 2.87 1.76 050 CATCH return error 7.94 7.11 3.42 051 CATCH return except 2.00 2.76 1.77 052 CATCH return ok 2.35 2.30 1.44 053 DATA access in a list 75.28 85.30 93.16 054 DATA access in an array 126.80 244.40 149.09 055 DATA create in a list 110.36 80.89 91.66 056 DATA create in an array 240.08 362.98 267.45 057 ENC iso2022-jp, gets 2737.27 2885.75 5476.90 058 ENC iso2022-jp, read 2983.01 3375.11 5992.63 059 ENC iso2022-jp, read & size 2614.15 3626.14 7255.57 060 ENC iso8859-2, gets 33.50 128.30 546.65 061 ENC iso8859-2, read 27.04 113.78 541.84 062 ENC iso8859-2, read & size 30.15 139.49 539.18 063 EVAL cmd and mixed lists 440.23 310.36 467.52 064 EVAL cmd eval as list 1.66 1.37 1.40 065 EVAL cmd eval as string 4.08 4.24 3.87 066 EVAL cmd eval in list obj var 2.59 2.53 1.91 067 EVAL cmd eval in list obj {*} 1.80 1.79 8.5+ 068 EVAL list cmd and mixed lists 449.02 379.01 530.42 069 EVAL list cmd and pure lists 13.96 17.82 13.82 070 EXPR $a != $b dbl 0.78 1.62 1.04 071 EXPR $a != $b int 0.62 2.05 1.44 072 EXPR $a != $b str (!= len) 1.15 2.91 1.81 073 EXPR $a != $b str (== len) 1.33 1.69 2.20 074 EXPR $a == $b dbl 0.67 2.13 1.18 075 EXPR $a == $b int 0.67 2.31 0.92 076 EXPR $a == $b str (!= len) 1.23 1.54 2.00 077 EXPR $a == $b str (== len) 1.61 1.57 2.57 078 EXPR abs as expr 0.68 1.80 1.05 079 EXPR abs builtin 1.15 1.34 1.00 080 EXPR braced 2.70 2.19 1.69 081 EXPR builtin dyn 8.33 7.40 5.78 082 EXPR builtin sin 1.11 0.92 0.90 083 EXPR cast double 1.18 1.25 1.20 084 EXPR cast int 1.29 1.44 0.72 085 EXPR fifty operands 2.60 3.86 2.19 086 EXPR incr with expr 0.59 0.52 0.64 087 EXPR incr with incr 0.47 0.55 0.70 088 EXPR inline 3.08 2.10 2.00 089 EXPR one operand 0.50 0.95 0.86 090 EXPR rand range 1.79 1.34 0.86 091 EXPR rand range func 2.49 1.86 1.58 092 EXPR ten operands 0.91 1.26 0.87 093 EXPR unbraced 16.46 18.56 15.04 094 EXPR unbraced long 42.72 40.34 65.75 095 EXPR UpdStrOfDbl+1.23 prec0 1.63 6.04 -=- 096 EXPR UpdStrOfDbl+1.23 prec12 1.25 2.60 1.79 097 EXPR UpdStrOfDbl+1.23 prec17 1.68 3.80 3.18 098 EXPR UpdStrOfDbl+1e-4 prec0 1.92 4.47 -=- 099 EXPR UpdStrOfDbl+1e-4 prec12 1.30 2.14 1.86 100 EXPR UpdStrOfDbl+1e-4 prec17 1.97 3.13 2.62 101 EXPR UpdStrOfDbl+1e27 prec0 4.08 4.23 -=- 102 EXPR UpdStrOfDbl+1e27 prec12 1.81 1.93 1.62 103 EXPR UpdStrOfDbl+1e27 prec17 7.11 3.35 2.79 104 FCOPY binary: 160K 7650.17 3701.10 3795.32 105 FCOPY encoding: 160K 7347.58 5603.14 6151.07 106 FCOPY std: 160K 4002.00 3742.82 3940.93 107 FILE exec interp 16963.16 10986.67 9948.67 108 FILE exec interp: pkg require 71852.66 72563.63 102763.8 109 FILE exists tmpfile (obj) 3.83 3.20 3.43 110 FILE exists ~ 3.45 4.02 2.99 111 FILE exists! tmpfile (obj) 3.01 4.05 3.51 112 FILE exists! tmpfile (str) 17.00 19.91 26.44 113 FILE glob tmpdir (60 entries) 79.97 128.35 116.35 114 FILE glob / all subcommands 7126.35 7040.26 5569.30 115 FILE glob / atime 1047.95 1502.17 1282.47 116 FILE glob / attributes 3358.57 3943.80 1975.15 117 FILE glob / dirname 128.20 178.66 279.58 118 FILE glob / executable 1487.16 1093.65 1187.75 119 FILE glob / exists 1204.73 1369.25 1216.79 120 FILE glob / extension 166.83 134.40 172.99 121 FILE glob / isdirectory 1096.24 1483.37 1216.40 122 FILE glob / isfile 1054.33 1234.92 1190.28 123 FILE glob / mtime 1014.72 1108.02 1411.60 124 FILE glob / owned 1178.54 1177.63 1330.03 125 FILE glob / readable 948.41 1184.79 1356.54 126 FILE glob / rootname 171.90 141.54 189.37 127 FILE glob / size 1382.07 1269.78 1215.26 128 FILE glob / tail 141.63 130.32 234.88 129 FILE glob / writable 1001.74 1179.97 1114.93 130 FILE recurse / -dir 4193.59 4604.86 5351.24 131 FILE recurse / cd 6515.83 7175.16 9499.38 132 FORMAT gen 1.61 1.99 1.64 133 GCCont_cpb::cGCC 50 49.62 34.14 26.76 134 GCCont_cpb::cGCC 500 256.43 205.15 173.90 135 GCCont_cpb::cGCC 5000 2492.35 2304.74 1420.11 136 GCCont_cpbre1::cGCC 50 50.01 47.42 49.93 137 GCCont_cpbre1::cGCC 500 296.21 304.43 444.83 138 GCCont_cpbre1::cGCC 5000 2561.55 3091.61 3577.26 139 GCCont_cpbre2::cGCC 50 37.88 40.34 47.25 140 GCCont_cpbre2::cGCC 500 310.72 353.33 344.52 141 GCCont_cpbre2::cGCC 5000 3025.56 3210.61 3372.26 142 GCCont_cpbrs2::cGCC 50 13.18 11.86 12.43 143 GCCont_cpbrs2::cGCC 500 36.01 48.70 64.17 144 GCCont_cpbrs2::cGCC 5000 280.55 361.94 409.66 145 GCCont_cpbrs::cGCC1 50 15.86 18.65 22.43 146 GCCont_cpbrs::cGCC1 500 46.87 57.12 97.95 147 GCCont_cpbrs::cGCC1 5000 264.12 412.04 581.50 148 GCCont_cpbrs::cGCC2 50 12.37 16.57 20.79 149 GCCont_cpbrs::cGCC2 500 40.06 49.85 82.35 150 GCCont_cpbrs::cGCC2 5000 246.46 323.87 430.56 151 GCCont_cpbrs_trap::cGCC 50 39.03 45.41 57.45 152 GCCont_cpbrs_trap::cGCC 500 320.01 362.43 401.53 153 GCCont_cpbrs_trap::cGCC 5000 2386.89 3286.44 3278.82 154 GCCont_expr::cGCC 50 25.08 31.61 28.37 155 GCCont_expr::cGCC 500 100.57 112.89 209.42 156 GCCont_expr::cGCC 5000 1163.38 1067.38 11194.76 157 GCCont_i::cGCC1 50 22.31 34.87 49.38 158 GCCont_i::cGCC1 500 171.86 221.53 504.28 159 GCCont_i::cGCC1 5000 1985.21 2772.24 4411.34 160 GCCont_i::cGCC2 50 23.46 27.37 15.80 161 GCCont_i::cGCC2 500 174.70 189.13 159.58 162 GCCont_i::cGCC2 5000 2063.47 2138.57 1265.04 163 GCCont_i::cGCC3 50 18.55 20.15 13.74 164 GCCont_i::cGCC3 500 138.23 160.87 110.85 165 GCCont_i::cGCC3 5000 1688.25 1623.13 1108.54 166 GCCont_r1::cGCC 50 37.93 33.48 70.07 167 GCCont_r1::cGCC 500 317.21 277.53 585.65 168 GCCont_r1::cGCC 5000 2455.35 2899.43 6145.00 169 GCCont_r2::cGCC 50 25.59 41.38 59.47 170 GCCont_r2::cGCC 500 251.98 259.13 470.93 171 GCCont_r2::cGCC 5000 2060.66 2292.97 5348.78 172 GCCont_r3::cGCC 50 25.29 33.68 69.65 173 GCCont_r3::cGCC 500 262.16 266.42 492.91 174 GCCont_r3::cGCC 5000 2682.22 2900.10 5554.98 175 GCCont_rsf1::cGCC 50 20.57 22.61 23.31 176 GCCont_rsf1::cGCC 500 129.17 202.92 141.75 177 GCCont_rsf1::cGCC 5000 1429.25 1646.95 1517.61 178 GCCont_rsf2::cGCC1 50 14.89 17.48 18.89 179 GCCont_rsf2::cGCC1 500 73.78 123.42 83.67 180 GCCont_rsf2::cGCC1 5000 692.22 692.80 789.69 181 GCCont_rsf2::cGCC2 50 13.25 13.32 14.75 182 GCCont_rsf2::cGCC2 500 84.52 100.30 89.61 183 GCCont_rsf2::cGCC2 5000 791.83 618.88 704.18 184 GCCont_rsf3::cGCC 50 16.63 16.58 12.95 185 GCCont_rsf3::cGCC 500 76.98 78.46 78.27 186 GCCont_rsf3::cGCC 5000 759.93 646.93 586.45 187 GCCont_turing::cGCC 50 8.98 15.16 11.91 188 GCCont_turing::cGCC 500 46.87 56.96 65.37 189 GCCont_turing::cGCC 5000 313.24 529.32 569.64 190 HEAPSORT size 10 26.84 53.27 36.97 191 HEAPSORT size 50 269.57 472.24 406.45 192 HEAPSORT size 100 743.76 1107.40 939.59 193 HEAPSORT2 size 10 25.34 35.45 38.13 194 HEAPSORT2 size 50 307.25 374.75 406.37 195 HEAPSORT2 size 100 715.40 650.67 1014.39 196 IF 1/0 check 0.97 0.68 0.82 197 IF else true al 1.38 1.91 1.93 198 IF else true numeric 0.83 1.38 0.90 199 IF elseif true al 1.22 1.86 2.47 200 IF elseif true numeric 0.97 1.41 0.86 201 IF if false al/al 1.33 2.19 1.26 202 IF if false al/num 0.98 1.42 1.03 203 IF if false num/num 0.80 1.38 0.80 204 IF if true al 0.84 1.30 1.26 205 IF if true al/al 1.12 1.22 1.02 206 IF if true num/num 0.99 1.21 0.85 207 IF if true numeric 0.94 1.23 0.92 208 IF multi 1st true 0.92 0.97 0.93 209 IF multi 2nd true 0.70 1.35 2.86 210 IF multi 9th true 1.55 2.10 1.68 211 IF multi default true 1.45 2.14 2.46 212 KLIST shuffle0 llength 1 4.88 4.75 5.40 213 KLIST shuffle0 llength 10 15.45 17.72 15.30 214 KLIST shuffle0 llength 100 132.61 115.46 156.62 215 KLIST shuffle0 llength 1000 1360.54 1287.52 1655.30 216 KLIST shuffle0 llength 10000 19875.74 18234.04 26629.50 217 KLIST shuffle1-s llength 1 3.44 3.80 7.75 218 KLIST shuffle1-s llength 10 20.27 29.84 29.57 219 KLIST shuffle1-s llength 100 359.97 407.01 291.92 220 KLIST shuffle1-s llength 1000 16027.01 16313.25 12891.61 221 KLIST shuffle1a llength 1 4.82 5.08 5.22 222 KLIST shuffle1a llength 10 31.80 35.96 32.12 223 KLIST shuffle1a llength 100 392.22 271.15 298.79 224 KLIST shuffle1a llength 1000 3667.02 2636.58 3396.77 225 KLIST shuffle1a llength 10000 31776.75 33972.63 33295.30 226 KLIST shuffle2 llength 1 3.64 4.06 4.48 227 KLIST shuffle2 llength 10 34.69 35.74 22.94 228 KLIST shuffle2 llength 100 203.32 286.23 239.97 229 KLIST shuffle2 llength 1000 2525.92 3649.89 2725.95 230 KLIST shuffle2 llength 10000 31013.22 51274.55 27492.60 231 KLIST shuffle3 llength 1 4.93 3.92 6.34 232 KLIST shuffle3 llength 10 40.75 21.56 21.79 233 KLIST shuffle3 llength 100 231.08 223.22 196.31 234 KLIST shuffle3 llength 1000 2295.88 1961.60 2353.92 235 KLIST shuffle3 llength 10000 56341.29 51503.83 30541.50 236 KLIST shuffle4 llength 1 5.79 3.56 4.42 237 KLIST shuffle4 llength 10 23.12 21.20 23.15 238 KLIST shuffle4 llength 100 210.15 197.92 217.66 239 KLIST shuffle4 llength 1000 2231.96 2614.74 2161.06 240 KLIST shuffle4 llength 10000 24829.51 22164.91 21152.50 241 KLIST shuffle5-s llength 1 3.68 2.38 3.74 242 KLIST shuffle5-s llength 10 17.92 15.59 13.54 243 KLIST shuffle5-s llength 100 184.49 168.16 158.76 244 KLIST shuffle5-s llength 1000 5414.01 4654.49 4939.31 245 KLIST shuffle5a llength 1 3.59 2.89 3.47 246 KLIST shuffle5a llength 10 25.87 30.69 27.22 247 KLIST shuffle5a llength 100 224.01 219.94 179.48 248 KLIST shuffle5a llength 1000 2432.85 2557.92 2258.25 249 KLIST shuffle5a llength 10000 50017.27 59075.28 35354.70 250 KLIST shuffle6 llength 1 1.27 1.08 0.91 251 KLIST shuffle6 llength 10 11.19 14.82 11.73 252 KLIST shuffle6 llength 100 102.85 131.48 84.94 253 KLIST shuffle6 llength 1000 952.86 1192.63 1052.95 254 KLIST shuffle6 llength 10000 12003.74 9641.82 10786.20 255 LIST append to list 0.79 0.90 1.16 256 LIST concat APPEND 2x10 5.07 4.72 5.62 257 LIST concat APPEND 2x100 43.90 28.68 35.58 258 LIST concat APPEND 2x1000 314.86 398.74 360.97 259 LIST concat APPEND 2x10000 4443.52 3270.56 3641.69 260 LIST concat CONCAT 2x10 2.11 2.59 2.08 261 LIST concat CONCAT 2x100 2.40 2.95 3.66 262 LIST concat CONCAT 2x1000 11.37 14.66 16.82 263 LIST concat CONCAT 2x10000 94.09 120.80 118.73 264 LIST concat EVAL/LAPPEND 2x10 3.33 2.26 3.10 265 LIST concat EVAL/LAPPEND 2x100 8.78 6.58 4.82 266 LIST concat EVAL/LAPPEND 2x1000 27.84 23.55 22.21 267 LIST concat EVAL/LAPPEND 2x10000 162.88 166.83 197.87 268 LIST concat FOREACH/LAPPEND 2x10 4.05 3.68 2.67 269 LIST concat FOREACH/LAPPEND 2x100 24.54 19.89 19.38 270 LIST concat FOREACH/LAPPEND 2x1000 294.75 148.04 114.74 271 LIST concat FOREACH/LAPPEND 2x10000 2323.16 1659.77 1440.41 272 LIST concat SET 2x10 4.39 5.15 3.86 273 LIST concat SET 2x100 49.43 25.32 27.87 274 LIST concat SET 2x1000 602.37 265.39 249.79 275 LIST concat SET 2x10000 3755.34 3587.60 3293.78 276 LIST exact search, first item 1.10 1.81 1.70 277 LIST exact search, last item 3.65 7.22 5.33 278 LIST exact search, middle item 2.92 2.63 2.88 279 LIST exact search, non-item 9.68 11.92 8.56 280 LIST exact search, typed item 4.68 7.59 3.56 281 LIST exact search, untyped item 5.41 6.33 4.55 282 LIST index first element 1.51 1.48 2.71 283 LIST index last element 0.87 0.90 0.83 284 LIST index middle element 0.97 0.88 0.84 285 LIST insert an item at "end" 13.52 7.32 6.42 286 LIST insert an item at middle 10.85 7.91 7.48 287 LIST insert an item at start 10.88 8.01 6.48 288 LIST iterate list 161.31 191.27 282.19 289 LIST join list 80.15 70.15 91.06 290 LIST large, early range 1.81 2.55 1.88 291 LIST large, late range 1.96 1.85 2.28 292 LIST length, pure list 1.32 1.60 0.88 293 LIST list 2.97 5.55 2.40 294 LIST lset foreach l 257.62 401.03 296.82 295 LIST lset foreach list 266.06 364.72 317.73 296 LIST lset foreach ""s l 74.60 106.34 77.02 297 LIST lset foreach ""s list 67.04 102.36 113.52 298 LIST regexp search, first item 1.30 1.73 2.55 299 LIST regexp search, last item 16.66 17.37 205.27 300 LIST regexp search, non-item 26.28 37.43 352.70 301 LIST remove first element 8.28 11.82 7.94 302 LIST remove in mixed list 9.59 13.88 6.71 303 LIST remove last element 8.03 10.47 5.19 304 LIST remove middle element 7.99 8.13 6.33 305 LIST replace first el with multiple 11.30 11.39 6.70 306 LIST replace first element 9.14 17.73 5.78 307 LIST replace in mixed list 8.84 9.38 6.85 308 LIST replace last el with multiple 8.81 17.03 5.45 309 LIST replace last element 10.42 9.37 5.90 310 LIST replace middle el with multiple 8.01 14.37 5.80 311 LIST replace middle element 8.65 12.03 5.85 312 LIST replace range 2.66 3.74 9.99 313 LIST reverse core 7.17 8.69 8.5+ 314 LIST reverse lappend 179.52 195.70 221.17 315 LIST small, early range 1.25 1.45 1.16 316 LIST small, late range 1.31 1.74 1.23 317 LIST sort 131.08 157.03 245.23 318 LIST sorted search, first item 1.67 1.55 1.66 319 LIST sorted search, last item 1.35 2.37 1.48 320 LIST sorted search, middle item 1.27 2.44 1.93 321 LIST sorted search, non-item 1.32 2.09 1.21 322 LIST sorted search, typed item 1.55 2.30 1.59 323 LIST typed sort 94.38 125.59 189.22 324 LOOP for (to 1000) 78.10 130.89 94.09 325 LOOP for, iterate list 123.46 266.84 218.02 326 LOOP for, iterate string 220.41 336.93 276.39 327 LOOP foreach, iterate list 170.04 243.33 100.35 328 LOOP foreach, iterate string 220.51 277.28 118.68 329 LOOP while (to 1000) 89.27 124.87 74.91 330 LOOP while 1 (to 1000) 85.03 132.67 81.86 331 MAP ([chars])-case regsub 18.80 37.06 28.50 332 MAP http mapReply 4884.75 7608.08 6931.14 333 MAP regsub -nocase, no match 118.29 166.07 109.86 334 MAP regsub 1 val 36.29 112.82 100.58 335 MAP regsub 1 val -nocase 71.30 192.40 138.36 336 MAP regsub 2 val 107.02 391.01 245.74 337 MAP regsub 2 val -nocase 146.55 339.43 431.85 338 MAP regsub 3 val 162.88 399.01 337.44 339 MAP regsub 3 val -nocase 224.85 645.03 573.67 340 MAP regsub 4 val 192.72 543.18 470.85 341 MAP regsub 4 val -nocase 230.31 758.15 581.64 342 MAP regsub short 2.14 5.98 3.53 343 MAP regsub, no match 45.01 70.14 40.61 344 MAP string -nocase, no match 159.37 351.99 227.01 345 MAP string 1 val 31.61 114.70 95.27 346 MAP string 1 val -nocase 88.15 150.98 137.16 347 MAP string 2 val 123.67 261.09 226.90 348 MAP string 2 val -nocase 160.17 335.86 315.60 349 MAP string 3 val 167.42 260.57 259.78 350 MAP string 3 val -nocase 236.06 458.77 451.69 351 MAP string 4 val 206.90 478.86 352.49 352 MAP string 4 val -nocase 231.35 611.23 544.57 353 MAP string short 2.34 5.82 4.45 354 MAP string, no match 80.13 179.68 140.83 355 MAP |-case regsub 12.71 17.93 20.33 356 MAP |-case strmap 2.55 4.91 4.67 357 MATRIX mult 5x5 80.85 114.99 83.01 358 MATRIX mult 10x10 597.01 790.93 582.34 359 MATRIX mult 15x15 1833.77 2763.88 1772.71 360 MATRIX transposition-0 491.24 790.94 461.16 361 MATRIX transposition-1 272.40 372.38 459.27 362 MD5 msg len 10 175.87 191.80 192.30 363 MD5 msg len 100 280.75 524.55 307.88 364 MD5 msg len 1000 2099.28 3945.55 2131.80 365 MD5 msg len 10000 58766.55 85647.10 19223.20 366 MTHD array stored proc call 0.94 1.94 1.09 367 MTHD call absolute 1.86 3.69 2.14 368 MTHD call relative 1.87 5.96 2.69 369 MTHD direct ns proc call 0.50 1.02 1.59 370 MTHD imported ns proc call 0.56 1.64 0.66 371 MTHD indirect proc eval 1.96 4.39 2.46 372 MTHD indirect proc eval #2 2.74 2.90 3.16 373 MTHD inline call 0.29 0.43 0.39 374 MTHD interp alias proc call 1.03 1.08 0.89 375 MTHD ns lookup call 7.31 12.95 6.65 376 MTHD switch method call 1.95 5.18 4.02 377 NS alternating 45.68 250.52 187.59 378 PARSE html form upload (7978) 1541.64 1704.70 1828.76 379 PARSE html form upload (993570) 180402.8 226687.0 208756.9 380 PROC do-nothing, no args 0.50 1.16 0.52 381 PROC do-nothing, one arg 0.45 1.12 0.75 382 PROC empty, no args 0.13 0.19 0.19 383 PROC empty, use args 0.14 0.19 0.18 384 PROC explicit return 0.64 0.85 0.64 385 PROC explicit return (2) 0.71 1.04 0.56 386 PROC explicit return (3) 1.66 1.48 0.57 387 PROC heavily commented 0.75 1.24 0.58 388 PROC implicit return 0.86 0.80 0.61 389 PROC implicit return (2) 0.49 1.29 0.61 390 PROC implicit return (3) 0.48 0.56 0.58 391 PROC local links with global 32.75 38.45 72.01 392 PROC local links with upvar 24.68 41.35 55.52 393 PROC local links with variable 26.11 34.13 48.45 394 RE 1-char long-end 5.94 8.58 9.35 395 RE 1-char long-end catching 10.74 15.64 11.58 396 RE 1-char long-middle 4.13 5.96 5.02 397 RE 1-char long-middle catching 7.19 13.67 11.93 398 RE 1-char long-start 1.57 2.63 2.84 399 RE 1-char long-start catching 6.74 9.84 7.23 400 RE 1-char short 1.41 2.94 2.04 401 RE 1-char short catching 6.10 11.32 10.75 402 RE basic 2.03 2.36 2.51 403 RE basic catching 7.34 11.08 9.02 404 RE c-comment long 6.76 15.97 9.11 405 RE c-comment long catching 24.40 34.46 25.07 406 RE c-comment long nomatch 9.90 15.27 15.01 407 RE c-comment long nomatch catching 11.14 20.46 14.84 408 RE c-comment long pmatch 9.71 25.14 16.12 409 RE c-comment long pmatch catching 15.01 18.62 17.17 410 RE c-comment many *s 12.30 19.56 14.89 411 RE c-comment many *s catching 33.96 51.71 42.19 412 RE c-comment nomatch 1.77 4.85 2.41 413 RE c-comment nomatch catching 2.95 5.34 4.88 414 RE c-comment simple 4.12 10.31 5.28 415 RE c-comment simple catching 19.44 29.07 24.74 416 RE count all matches 15.27 20.41 37.79 417 RE extract all matches 17.92 26.38 29.67 418 RE ini file 8076.56 12178.11 9331.67 419 RE ini file ng 52.13 82.04 51.97 420 RE literal regexp 2.82 2.98 6.59 421 RE n-char long-end 6.09 8.96 7.33 422 RE n-char long-end catching 11.34 17.96 13.99 423 RE n-char long-middle 4.02 6.41 5.55 424 RE n-char long-middle catching 9.48 15.61 16.16 425 RE n-char long-start 1.87 3.55 2.87 426 RE n-char long-start catching 7.05 11.51 9.77 427 RE n-char short 2.54 3.24 2.27 428 RE n-char short catching 9.00 9.53 11.13 429 RE static anchored match 0.59 1.09 1.00 430 RE static anchored match dot 0.50 1.16 4.36 431 RE static anchored nomatch 0.49 0.80 0.73 432 RE static anchored nomatch dot 0.49 0.83 1.43 433 RE static l-anchored match 0.99 2.08 0.64 434 RE static l-anchored nomatch 0.69 0.78 0.72 435 RE static long match 1.86 2.82 2.58 436 RE static long nomatch 1.99 3.63 3.85 437 RE static r-anchored match 0.52 0.94 0.70 438 RE static r-anchored nomatch 0.51 0.80 0.80 439 RE static short match 0.72 1.26 0.66 440 RE static short nomatch 0.70 1.09 0.63 441 RE var ***= directive match 1.38 2.03 2.87 442 RE var ***= directive nomatch 1.47 2.54 3.60 443 RE var . match 1.19 1.60 2.15 444 RE var [0-9] match 3.98 3.76 3.46 445 RE var \d match 2.58 4.41 3.16 446 RE var ^$ nomatch 1.05 1.42 2.08 447 RE var backtrack case 3.34 38.22 3.72 448 RE var-based regexp 2.88 4.56 7.39 449 READ 595K, cat 22741.32 37974.55 29677.63 450 READ 595K, gets 14896.05 24375.58 17568.00 451 READ 595K, glob-grep match 22517.66 32772.21 26302.91 452 READ 595K, glob-grep nomatch 22146.32 31328.56 25170.46 453 READ 595K, read 5072.98 7692.06 5854.03 454 READ 595K, read & size 5578.37 8507.96 5933.23 455 READ 595K, read dyn buf 4862.90 9821.42 5529.71 456 READ 595K, read small buf 106932.1 156669.0 138987.8 457 READ 3050b, cat 121.37 267.86 233.17 458 READ 3050b, gets 135.74 155.98 131.29 459 READ 3050b, glob-grep match 119.92 188.83 145.08 460 READ 3050b, glob-grep nomatch 145.14 221.84 151.13 461 READ 3050b, read 38.50 58.28 44.12 462 READ 3050b, read & size 47.24 67.14 61.23 463 READ 3050b, read dyn buf 36.86 67.70 50.90 464 READ 3050b, read small buf 460.55 670.94 757.44 465 READ bin 595K, cat 13311.96 16066.91 34526.71 466 READ bin 595K, gets 7884.47 12720.75 20417.14 467 READ bin 595K, glob-grep match 10776.52 15214.41 27593.71 468 READ bin 595K, glob-grep nomatch 11543.41 12172.33 26651.49 469 READ bin 595K, read 1256.75 1668.86 931.63 470 READ bin 595K, read & size 1466.92 1463.90 1125.67 471 READ bin 595K, read dyn buf 1315.47 1755.47 1098.49 472 READ bin 595K, read small buf 100468.0 140927.3 130969.2 473 READ bin 3050b, cat 98.55 149.79 241.31 474 READ bin 3050b, gets 77.15 96.43 125.96 475 READ bin 3050b, glob-grep match 81.42 159.13 230.76 476 READ bin 3050b, glob-grep nomatch 81.31 147.69 234.36 477 READ bin 3050b, read 29.05 50.95 34.41 478 READ bin 3050b, read & size 31.64 64.13 33.84 479 READ bin 3050b, read dyn buf 30.87 55.41 49.80 480 READ bin 3050b, read small buf 418.44 751.76 738.88 481 SHA1 msg len 10 238.99 311.44 373.55 482 SHA1 msg len 100 456.79 552.35 550.49 483 SHA1 msg len 1000 2962.13 4968.88 5505.85 484 SHA1 msg len 10000 29768.60 40934.00 42375.00 485 SPLIT iter, 4000 uchars 1168.39 1280.69 638.34 486 SPLIT iter, 4010 chars 1096.38 1236.55 631.76 487 SPLIT iter, rand 100 c 40.14 52.60 33.54 488 SPLIT iter, rand 1000 c 358.84 353.56 195.19 489 SPLIT iter, rand 10000 c 2216.71 3266.38 1433.12 490 SPLIT on 'c', 4000 uchars 43.59 58.92 34.89 491 SPLIT on 'c', 4010 chars 42.71 54.11 38.54 492 SPLIT on 'cz', 4000 uchars 114.24 155.81 100.91 493 SPLIT on 'cz', 4010 chars 93.93 148.28 89.87 494 SPLIT on 'cû', 4000 uchars 157.89 182.68 103.27 495 SPLIT on 'cû', 4010 chars 89.52 131.61 95.43 496 SPLIT, 4000 uchars 321.99 252.73 219.71 497 SPLIT, 4010 chars 190.45 215.16 169.80 498 SPLIT, rand 100 c 20.81 28.56 22.85 499 SPLIT, rand 1000 c 173.52 137.74 148.35 500 SPLIT, rand 10000 c 916.60 788.00 620.36 501 STR append 3.21 4.75 4.74 502 STR append (1KB + 1KB) 2.17 3.15 2.18 503 STR append (1MB + (1b+1K+1b)*100) 1988.50 674.11 3919.68 504 STR append (1MB + 1KB) 1671.57 1846.95 2942.22 505 STR append (1MB + 1KB*20) 1686.69 1950.86 2538.61 506 STR append (1MB + 1KB*1000) 2649.95 4014.85 2724.80 507 STR append (1MB + 1MB*3) 2898.98 3893.80 13261.46 508 STR append (1MB + 1MB*5) 11283.40 9212.57 16403.86 509 STR append (1MB + 2b*1000) 554.03 531.04 420.44 510 STR append (10KB + 1KB) 3.77 5.47 4.23 511 STR first (failure) 7.50 11.64 11.18 512 STR first (failure) utf 8.00 13.88 8.21 513 STR first (success) 1.23 2.15 1.38 514 STR first (success) utf 0.82 2.00 1.31 515 STR first (total failure) 6.64 7.40 9.39 516 STR first (total failure) utf 5.47 7.80 6.07 517 STR index 0 1.72 1.61 1.13 518 STR index 100 1.42 1.71 1.37 519 STR index 500 1.09 1.96 1.41 520 STR info locals match 36.98 31.45 48.34 521 STR last (failure) 7.86 18.32 16.12 522 STR last (success) 1.37 2.48 1.20 523 STR last (total failure) 7.95 6.80 6.10 524 STR length (==4010) 0.89 1.25 1.89 525 STR length growing (1000) 217.30 186.20 135.55 526 STR length growing uc (1000) 250.35 183.71 143.68 527 STR length of a LIST 0.75 1.20 1.00 528 STR length static str 1.19 0.83 0.93 529 STR match, complex (failure) 6.95 12.50 10.31 530 STR match, complex (success early) 1.03 1.84 0.97 531 STR match, complex (success late) 11.81 19.47 15.39 532 STR match, complex (total failure) 5.66 7.97 5.16 533 STR match, exact (failure) 0.50 1.18 0.65 534 STR match, exact (success) 0.53 0.90 1.10 535 STR match, exact -nocase (failure) 0.62 1.25 0.62 536 STR match, exact -nocase (success) 0.93 1.61 1.10 537 STR match, recurse (fail backtrack) 55.41 80.34 54.35 538 STR match, recurse (fail bt1) 84.93 91.99 65.50 539 STR match, recurse (fail bt2) 85.32 75.61 50.77 540 STR match, recurse (fail ranchor) 7227.01 10080.35 10814.31 541 STR match, recurse (success bt2) 13.28 15.95 9.25 542 STR match, recurse2 (fail) 14558.25 20413.30 13371.66 543 STR match, recurse2 (success) 10.83 11.96 12.00 544 STR match, simple (failure) 0.56 1.68 0.76 545 STR match, simple (success) 0.52 1.28 0.70 546 STR range, index 100..200 of 4010 1.32 2.05 1.39 547 STR repeat, 4010 chars * 10 5.11 5.99 6.97 548 STR repeat, 4010 chars * 100 48.52 56.34 31.81 549 STR repeat, abcdefghij * 10 1.30 2.37 1.11 550 STR repeat, abcdefghij * 100 3.14 4.07 2.04 551 STR repeat, abcdefghij * 1000 10.55 17.22 13.76 552 STR replace, equal replacement 2.40 4.51 2.52 553 STR replace, longer replacement 3.52 3.87 2.49 554 STR replace, no replacement 2.12 3.65 1.84 555 STR reverse core, 10 c 1.82 2.77 8.5+ 556 STR reverse core, 10 uc 2.09 2.91 8.5+ 557 STR reverse core, 100 c 2.10 1.93 8.5+ 558 STR reverse core, 100 uc 1.83 2.42 8.5+ 559 STR reverse core, 400 c 1.99 2.74 8.5+ 560 STR reverse core, 400 uc 2.58 2.17 8.5+ 561 STR reverse iter/append, 10 c 5.38 5.87 5.61 562 STR reverse iter/append, 10 uc 5.80 7.47 5.49 563 STR reverse iter/append, 100 c 33.43 34.83 35.77 564 STR reverse iter/append, 100 uc 28.63 40.40 36.65 565 STR reverse iter/append, 400 c 105.46 154.97 133.90 566 STR reverse iter/append, 400 uc 123.42 172.34 130.62 567 STR reverse iter/set, 10 c 6.18 7.95 6.52 568 STR reverse iter/set, 10 uc 4.92 7.85 7.93 569 STR reverse iter/set, 100 c 41.93 47.14 50.26 570 STR reverse iter/set, 100 uc 38.07 58.05 49.99 571 STR reverse iter/set, 400 c 154.98 229.60 213.19 572 STR reverse iter/set, 400 uc 153.40 227.33 219.92 573 STR reverse recursive, 10 c 10.31 32.13 16.99 574 STR reverse recursive, 10 uc 9.03 24.38 14.89 575 STR reverse recursive, 100 c 92.30 251.54 242.97 576 STR reverse recursive, 100 uc 91.34 247.10 180.58 577 STR reverse recursive, 400 c 508.56 1053.75 802.53 578 STR reverse recursive, 400 uc 863.50 1054.61 1065.13 579 STR str $a eq $b 1.62 1.64 1.20 580 STR str $a eq $b (same obj) 1.19 1.73 1.52 581 STR str $a equal "" 0.98 1.57 0.91 582 STR str $a ne $b 1.52 1.72 1.26 583 STR str $a ne $b (same obj) 1.45 1.62 1.46 584 STR str num == "" 0.91 1.68 1.06 585 STR strcmp bin long eq 11.49 10.73 9.65 586 STR strcmp bin long neq 14.05 14.31 9.36 587 STR strcmp bin long neqS 4.19 8.16 3.65 588 STR strcmp bin short eq 3.00 3.62 2.03 589 STR streq bin long eq 10.40 217.92 175.89 590 STR streq bin long neq 10.61 242.43 188.39 591 STR streq bin long neqS 6.20 214.95 222.99 592 STR streq bin short eq 3.72 5.47 3.92 593 STR string compare 1.28 1.87 1.28 594 STR string compare "" 1.01 2.26 1.62 595 STR string compare long 4.20 4.99 3.42 596 STR string compare long (same obj) 0.96 1.54 1.52 597 STR string compare mixed long 19.02 35.29 23.73 598 STR string compare uni long 21.70 36.18 22.83 599 STR string equal "" 1.12 1.96 2.59 600 STR string equal long (!= len) 1.88 2.18 1.78 601 STR string equal long (== len) 4.75 6.23 4.66 602 STR string equal long (same obj) 1.77 1.80 1.50 603 STR string equal mixed long 1.57 2.09 1.32 604 STR string equal uni long 5.35 6.77 6.81 605 STR/LIST length, obj shimmer 210.62 190.65 143.34 606 SWITCH 1st true 0.59 0.67 8.03 607 SWITCH 2nd true 0.80 0.75 7.99 608 SWITCH 9th true 0.92 1.11 10.16 609 SWITCH default true 0.89 1.04 7.61 610 TRACE all set (rwu) 1.07 2.07 3.65 611 TRACE no trace set 1.17 1.62 2.36 612 TRACE read 1.22 2.00 2.99 613 TRACE unset 1.46 1.68 4.40 614 TRACE write 1.37 2.05 4.49 615 UNSET catch var !exist 7.77 6.92 4.27 616 UNSET catch var exists 0.69 0.98 1.18 617 UNSET info check var !exist 0.61 1.06 2.44 618 UNSET info check var exists 0.55 1.25 2.09 619 UNSET nocomplain var !exist 0.56 1.30 5.52 620 UNSET nocomplain var exists 0.58 1.35 4.17 621 UNSET var exists 0.69 1.07 1.13 622 UPLEVEL none 210.36 274.60 258.17 623 UPLEVEL primed 583.61 670.03 8032.84 624 UPLEVEL to nseval 1129.53 970.30 11301.26 625 UPLEVEL to proc 1121.16 840.31 11875.00 626 VAR 'array set' of 100 elems 39.13 10.60 16.13 627 VAR 100 'set's in array 11.79 7.83 13.67 628 VAR access global 1.33 1.49 1.22 629 VAR access local proc arg 0.61 1.09 0.87 630 VAR access locally set 0.85 0.86 0.71 631 VAR access upvar 1.24 1.11 1.40 632 VAR incr global var 1000x 225.07 186.92 241.42 633 VAR incr local var 1000x 269.30 191.12 275.57 634 VAR incr upvar var 1000x 237.71 179.54 204.77 635 VAR mset 1.90 3.62 2.74 636 VAR mset (foreach) 2.18 1.11 1.17 637 VAR ref absolute 99.86 40.50 54.71 638 VAR ref local 8.21 3.98 5.84 639 VAR ref variable 4.97 4.15 16.34 640 VAR set array element 1.28 1.03 2.91 641 VAR set scalar 1.55 0.58 0.72 642 WORDCOUNT wc1 309.48 366.92 408.00 643 WORDCOUNT wc2 233.70 73.20 104.60 644 WORDCOUNT wc3 187.32 57.45 89.78 644 BENCHMARKS 1:8.6.0 2:8.5.7 3:8.4.19 000 VERSIONS: 1:8.6.0 2:8.5.7 3:8.4.19 001 CANVAS cget/incr -width 3.01 2.05 2.74 002 CANVAS configure -bg 1.56 1.45 1.16 003 CANVAS configure all 21.42 14.81 10.89 004 CANVAS create 50.39 90.00 23.23 005 CANVAS create (one exists) 31.90 44.71 18.23 006 CANVAS draw-3 100 5325.59 5482.63 1982.27 007 CANVAS simple draw 10 698.76 555.22 217.89 008 CANVAS simple draw 100 5045.62 8233.86 2083.97 009 CANVAS simple draw 1000 53576.93 65970.76 23968.62 010 ENTRY create 117.40 114.67 58.27 011 ENTRY create (one exists) 65.23 51.11 33.45 012 STARTUP time to launch wish 110827.1 135853.4 219549.6 012 BENCHMARKS 1:8.6.0 2:8.5.7 3:8.4.19 ====== <> Performance | Tcl Implementations