Skip to content
Tcl Source Code View Ticket
Login

View Ticket

use memmove() in Tcl_ListObjReplace()

Closed / Fixed1064243fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-11-11 01:11:58
Tcl_ListObjReplace() should use memmove() instead
of a manual copy loop to shift list elements in memory.
The attached patch decreases time spent inTcl_ListObjReplace() 
from 5.2% to 1.7% of overall runtime of
tclbench on a ppc 7455 (i.e. 200% speed increase).

also contained in the patch a small performance tweak to tclHash.c: 
this hoists a few constant pointer dereferences out
of loops to eliminate redundant loads that the gcc optimizer didn't
deal with. Decreases time spend in Tcl_FindHashEntry() by 10% 
over a full run of the tcl testuite on a ppc 7455.
dasplain2004-11-11 08:11:59
File Added - 108374: perf-tweak-HEAD.diff
dasplain2004-11-11 08:12:42
File Added - 108375: perf-tweak-core-8-4-branch.diff
dasplain2004-11-11 08:22:39
Logged In: YES 
user_id=90580

Jeff,
went ahead and committed this to HEAD and core-8-4-branch, hope that's 
ok, the changes are minor and should not be controversial.
das Open ticket [1064243fff]. [History diff]2004-11-11 08:23:09
hobbsplain2004-11-11 23:16:33
Logged In: YES 
user_id=72656

Sounds good to me.
dkfplain2004-11-12 16:09:59
Logged In: YES 
user_id=79902

The only thing to watch out for is whether memmove() is
going to have any additional requirements on the configure
script and portability. Apart from that, no objection
whatsoever. :^)
dasplain2004-11-12 16:28:00
Logged In: YES 
user_id=90580

but memmove() is already used in a number of places in the core (in 
tclParseExpr.c, tclIOGT.c, tclIO.c) so this does not create a new 
dependency, configure and compat/string.h already deal with it...
das Pending ticket [1064243fff]. [History diff]2004-11-12 16:29:11
hobbs Closed ticket [1064243fff]. [History diff]2004-11-23 14:24:40
Log in (anonymous is fine) to add a comment.

Attachments: