Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-10-01
19:46 • Closed ticket [1037357fff]: Speedup for uplevel and upvar plus 8 other c... artifact: e5a641acad user: dkf
2004-09-30
22:52 • Ticket [1037357fff]: 4 changes artifact: 65091c636e user: dgp
22:37 • Ticket [1037357fff]: 4 changes artifact: 3e937ec84b user: dkf
22:36 • Add attachment 1037357_2.patch to ticket [1037357fff] artifact: a9bfa3c649 user: dkf
22:36 • Ticket [1037357fff] Speedup for uplevel and upvar status still Open with... artifact: d22b34e9d3 user: dkf
22:36 • Ticket [1037357fff]: 4 changes artifact: 56b314d864 user: dkf
15:13 • Ticket [1037357fff]: 4 changes artifact: dc3b84ab8c user: dkf
09:31 • Ticket [1037357fff]: 4 changes artifact: 23b95e5a8c user: dgp
08:48 • Ticket [1037357fff]: 4 changes artifact: 2c7109f29b user: dgp
08:10 • Ticket [1037357fff]: 4 changes artifact: 7de455a061 user: dgp
07:15 • Ticket [1037357fff]: 4 changes artifact: 088f470f35 user: dgp
07:15 • Add attachment 1037357.patch to ticket [1037357fff] artifact: d26de26fe0 user: dgp
06:47 • Ticket [1037357fff] Speedup for uplevel and upvar status still Open with... artifact: 271af7a7ab user: dgp
06:42 • Ticket [1037357fff]: 4 changes artifact: 876e02b37a user: dgp
05:59 • Ticket [1037357fff]: 4 changes artifact: ba1ee90618 user: dkf
2004-09-29
22:59 • New ticket [1037357fff]. artifact: e8742c36c2 user: dkf

Speedup for [uplevel] and [upvar]

Closed / Accepted1037357fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-09-29 22:59:22
This patch speeds up [uplevel] and [upvar] by caching
the result of parsing the string form of the level
indicator in the Tcl_Obj argument instead of always
working with the string form for everything.
dkfplain2004-09-30 05:59:22
File Added - 103249: objup.diff
dgpplain2004-09-30 06:42:13
File Added - 103256: 1037357.patch

Logged In: YES 
user_id=80530

corrected  patch applies and compiles.
dgpplain2004-09-30 06:47:46
Logged In: YES 
user_id=80530

The comments in Tcl*GetFrame
say "modify the interpreter", but
neither routine actually does that.
dgpplain2004-09-30 07:15:49
File Deleted - 103256: 



File Added - 103261: 1037357.patch

Logged In: YES 
user_id=80530

updated patch takes care of comments
and allows `make genstubs` to succeed.
dgpplain2004-09-30 08:10:58
Logged In: YES 
user_id=80530

something about the patch
breaks tcltest:

dict.test
Test file error: can't rename "::tcltest::Replace::Puts":
command doesn't exist
    while executing
"rename [namespace current]::Replace::Puts ::puts"
    (procedure "::tcltest::Eval" line 16)
    invoked from within
"::tcltest::Eval {::tcltest::RunTest dict-18.2 {# Test that
the dictionary is a valid list
        set d [dict create "abc def" 0 "a\{b" 1 "c\}d" 2]
  ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 [list [namespace origin Eval] $command 1]"
    (procedure "test" line 126)
    invoked from within
"test dict-18.2 {dict-list relationship} {
    -body {
        # Test that the dictionary is a valid list
        set d [dict create "abc def" 0 "a\{b"..."
    (file "/local/src/tcl/tests/dict.test" line 726)
dgpplain2004-09-30 08:48:33
Logged In: YES 
user_id=80530


Root of the problem appears to
be line 1965 of tcltest.tcl where
the literal "1" appears twice.
First as the "level" argument
to [uplevel] and second as an
argument in the command to
be evaluated up a level.  Something
isn't shimmering right, I'd suspect.

As a check, if I remove the second "1"
from that line (and accept the default
value of that argument, which is 1),
then the problem goes away.
dgpplain2004-09-30 09:31:12
Logged In: YES 
user_id=80530


This patch should be checked
against tclbench.  I suspect that
whatever is being saved by
repeated use of $level by 
multiple [uplevel]s and [upvar]s
is more than being lost by
the greatly increased shimmering of
the literal constant "1" in so many
logical expressions.

`make test` sure feels a lot slower anyway.
dkfplain2004-09-30 15:13:51
Logged In: YES 
user_id=79902

Thanks for the review; I'll have to write a new version that
is aware of numeric types and avoids the conversion in those
situations. I suspected I needed to do this anyway ;^)
dkfplain2004-09-30 22:36:51
Logged In: YES 
user_id=79902

Here's a version that shouldn't have problems with
shimmering all over the place.  Causes no new test failures.
 No idea (formally) what happens in tclbench, but looks good
in informal trials. ;^)
dkfplain2004-09-30 22:36:52
File Added - 103339: 1037357_2.patch
dkfplain2004-09-30 22:37:12
File Deleted - 103249:
dgpplain2004-09-30 22:52:03
Logged In: YES 
user_id=80530

revised patch tests ok.
dkfplain2004-10-01 19:46:02
Logged In: YES 
user_id=79902

Applied to HEAD
Log in (anonymous is fine) to add a comment.

Attachments: