Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Optimizing [if {[string compare]} ...]

Open562297ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 17 years ago
Descriptionplain2002-05-30 11:11:31
This patch converts [string compare] so that it
generates INST_STR_EQ;INST_LNOT instead of INST_STR_CMP
when the comparison is going to be used as a boolean
test in the [if], [for] and [while] commands.  This
should be faster, particularly on longer strings,
because we don't need to know how the strings differ. 
Part of the patch could be construed to form the basis
for a more general optimization framework, but that
probably needs more work to realize...
dkfplain2002-05-30 18:11:31
File Added - 24029: str_optimize.patch
msoferplain2002-05-30 22:48:12
File Added - 24060: str_optimize.patch2

Logged In: YES 
user_id=148712

Updated patch (after HEAD modifs due to [Bug 562383].
hobbsplain2002-08-08 14:45:21
Logged In: YES 
user_id=72656

While this looks good in general, I'd prefer focusing on a post-
pass optimizer that can look at the whole tree and streamline 
such cases globally.  Thus we could also get rid of the 
INST_TRY_CVT_NUMERIC in many cases, along with finding 
INST_STR_CMP == 0 static, which is INST_STR_EQ, etc.
msoferplain2006-09-30 08:02:47
Logged In: YES 
user_id=148712

After so many years ... we'll eventually have the
post-optimiser.
sf-robotplain2006-10-14 09:20:08
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
dkfplain2006-10-14 23:08:12
Logged In: YES 
user_id=79902

Assigned to me so I remember to revisit this once we've
solved the general optimization stuff.
dkf Ticket [562297ffff]: 1 change [History diff]2009-10-23 15:45:30
Log in (anonymous is fine) to add a comment.

Attachments: