Overview
| Artifact ID: | cc13cd1870bf5a14f9935359a2395246576b3a57 |
|---|---|
| Ticket: | 458361ffffffffffffffffffffffffffffffffff
single word scripts get recompiled at each call |
| User & Date: | msofer on 2001-09-04 12:02:38 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed to:
(see also http://groups.google.com/groups?hl=en&safe=off&threadm=3B9458E6.93CEF15F%40ActiveState.com&prev=/groups%3Foi%3Ddjq%26as_ugroup%3Dcomp.lang.tcl) The output of proc testproc {args} {set x 1} proc test0 {} {puts "proc test0: [time {testproc} 100000]"} proc test1 {} {puts "proc test1: [time {testproc } 100000]"} proc test2 {} {eval {puts "proc test2: [time {testproc} 100000]"}} puts "top level: [time {testproc } 100000]" test0 test1 test2 is [mig@mini unix]$ tclsh test2 top level: 4 microseconds per iteration proc test0: 20 microseconds per iteration proc test1: 4 microseconds per iteration proc test2: 4 microseconds per iteration I think that the problem in test0 is caused by shimmering of the literal "testproc": - it is converted to tclByteCodeType by Tcl_EvalObjEx - it is converted to tclCommandNameType by Tcl_ExecuteByteCode So, the difference would be: - in test0, "testproc" is parsed, compiled and looked up as a command repeatedly - at top-level and in test2, "testproc" never becomes a tclByteCodeType - in test1, there are two different literals: "testproc " is always tclByteCodeType, "testproc" is always tclCommandNameType This would explain why the difference only occurs at calls with no arguments. - foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "msofer"
- subsystem changed to: "47. Bytecode Compiler"
- title changed to: "slow calls of cmds with no arguments"
- type changed to: "Bug"