Tcl Source Code

View Ticket
Login
Ticket UUID: 1064243
Title: use memmove() in Tcl_ListObjReplace()
Type: Patch Version: None
Submitter: das Created on: 2004-11-11 01:11:58
Subsystem: 14. List Object Assigned To: hobbs
Priority: 8 Severity:
Status: Closed Last Modified: 2004-11-23 14:24:40
Resolution: Fixed Closed By: hobbs
    Closed on: 2004-11-23 07:24:40
Description:
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.
User Comments: das added on 2004-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...

dkf added on 2004-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. :^)

hobbs added on 2004-11-11 23:16:33:
Logged In: YES 
user_id=72656

Sounds good to me.

das added on 2004-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 added on 2004-11-11 08:12:42:

File Added - 108375: perf-tweak-core-8-4-branch.diff

das added on 2004-11-11 08:11:59:

File Added - 108374: perf-tweak-HEAD.diff

Attachments: