| Ticket UUID: | 456668 | ||
| Title: | caching fully qualified cmd names | ||
| Type: | Patch | Created on: | 2001-08-29 21:48:03 |
| Submitter: | msofer | Assigned to: | msofer |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 5 Medium | Last modified: | 2001-09-06 03:18:36 |
| Status: | Closed | Closed by: | msofer |
| Resolution: | Accepted | Closed on: | 2001-09-05 20:18:36 |
| Version: | None | ||
| Description: | ||||
The enclosed patch allows cached fully qualified
command names to be usable from different namespaces
within the same interpreter.
This costs next to nothing for normal scripts, and may
be valuable for OO apps that pass around command names
in variables ("this").
| ||||
| User Comments: | ||||
msofer added on 2001-08-30 04:48:04:
File Added - 10148: cmdName.patch hobbs added on 2001-08-30 06:50:04:
Logged In: YES user_id=72656 can you elaborate a bit more on a use case? Perhaps something that could be added to tclbench. msofer added on 2001-08-30 07:41:11:
Logged In: YES
user_id=148712
The speedup can be noticeable; witness
[mig@mini unix]$ cat /tmp/testfile
proc a {} {return 1}
namespace eval n1 {
proc b {scr} {$scr}
}
proc c {scr} {
n1::b $scr
$scr
}
proc d {} {
append res [time {c a} 10000]\n
append res [time {c ::a} 10000]
}
puts [info patch]
puts [d]
[mig@mini unix]$ ./tclsh /tmp/testfile
8.4a4
12 microseconds per iteration
8 microseconds per iteration
[mig@mini unix]$ /CVS/tcl_SF_clean/unix/tclsh /tmp/testfile
8.4a4
13 microseconds per iteration
12 microseconds per iteration
[mig@mini unix]$ tclsh /tmp/testfile
8.3.3
15 microseconds per iteration
15 microseconds per iteration
Jeff: does this patch look OK to you?
hobbs added on 2001-08-30 08:08:11:
Logged In: YES
user_id=72656
The patch passes all tests, and there is a notable
improvement, so I say go ahead and commit it. Please
change it first to not use the { } frame instantiation
trick in C to create new vars.
msofer added on 2001-08-30 19:11:02:
File Deleted - 10148: File Added - 10175: cmdName.patch Logged In: YES user_id=148712 Patch adapted and committed. msofer added on 2001-09-06 03:18:36:
Logged In: YES user_id=148712 See also the companion patch #458872 that does the same caching for namespace names. | ||||
Attachments:
- cmdName.patch [download] added by msofer on 2001-08-30 19:11:02. [details]
