Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-03-18
22:32 • Ticket [1165671fff] inefficient bytecode for incr x -1 status still Closed... artifact: 22ef5d6967 user: dgp
22:32 • Closed ticket [1165671fff]. artifact: 0665873aa8 user: dgp
06:42 • Ticket [1165671fff]: 4 changes artifact: 48c6c015d4 user: dgp
06:42 • Add attachment immincr.patch to ticket [1165671fff] artifact: 7519fab383 user: dgp
2005-03-17
23:42 • New ticket [1165671fff] inefficient bytecode for incr x -1. artifact: a6c5990a8c user: dgp

inefficient bytecode for [incr x -1]

Closed / Fixed1165671fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-03-17 23:42:19
During the CONST reforms leading up
to Tcl 8.4 that allowed const strings
to be passed to Tcl_Eval(), etc...
a call to TclLooksLikeInt() was replaced
by TclParseInteger() in the
TclCompileIncrCmd() routine.

TclLooksLikeInt() allows for leading
whitespce and + and -, while TclParseInteger()
does not.  So the test doesn't pass as
often as it used to, or as it should.
When the test passes, immediate
operands are compiled into the
bytecode allowing for more efficient
execution.

As it happems, TclLooksLikeInt()
is happy and safe to use with const
strings.  The attached patch restores
it, which allows increments containing
whitespace and leading sign characters
to be compiled to more efficient bytecode.
The most notable case is probably
[incr x -1].  Will be interesting to see if
this change shows up in any benchmarks.
dgpplain2005-03-18 06:42:21
File Added - 126170: immincr.patch
dgp Closed ticket [1165671fff]. [History diff]2005-03-18 22:32:32
dgpplain2005-03-18 22:32:33
Logged In: YES 
user_id=80530


fix committed for 8.4.10 and 8.5a3
Log in (anonymous is fine) to add a comment.

Attachments: