Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-08-17
21:22 • Ticket [1447328fff] performance of concat and empty lists status still Clo... artifact: ef662c996c user: msofer
2008-01-12
20:14 • Closed ticket [1447328fff]. artifact: bb765a634c user: msofer
2007-10-28
18:05 • Ticket [1447328fff]: 4 changes artifact: e77a5666a9 user: dkf
10:19 • Ticket [1447328fff]: 2 changes artifact: 1228433f4d user: msofer
10:19 • Ticket [1447328fff]: 4 changes artifact: afbe7f8b5e user: msofer
2006-09-30
08:09 • Ticket [1447328fff]: 1 change artifact: 6b88348050 user: msofer
2006-03-10
16:21 • New ticket [1447328fff]. artifact: 8824719acc user: msofer

performance of [concat] and empty lists

Closed / Fixed1447328fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 18 years ago
Descriptionplain2006-03-10 16:21:24
As noted in bugs 1143805 and 1178805, [concat]'s
performance may suffer when one of it's arguments is an
empty list.

Specifically, as empty lists may have non-list internal
representations, they appear as empty strings.
Currently this can force an unnecessary round trip over
the string rep when all arguments are pure lists but
some of them are empty.
msofer Ticket [1447328fff]: 1 change [History diff]2006-09-30 08:09:34
msoferplain2007-10-28 10:19:37
Logged In: YES 
user_id=148712
Originator: YES

Fixed by optimizing for any Tcl_Obj that are either empty lists or objs with an empty string rep, independently of their internal rep.
Leaving open as a remainder: is it possibly worth optimising for dicts too?
msofer Ticket [1447328fff]: 2 changes [History diff]2007-10-28 10:19:38
dkfplain2007-10-28 18:05:08
Logged In: YES 
user_id=79902
Originator: NO

Since I don't really recommend concatenating dicts at all, what you do about them is not a big issue to me.
msofer Closed ticket [1447328fff]. [History diff]2008-01-12 20:14:20
msoferplain2008-08-17 21:22:14
Logged In: YES 
user_id=148712
Originator: YES

Oops ...this turned Tcl_ConcatObj from reader to hairy monster, see [Bug 2055782]. This is against the documented behaviour. This only happens when concat'ing one or more empty objs with a single list.

Additionally Tcl_ConcatObj() would corrupt its input when: all things to be concat'ed were either empties or canonical lists, and at least 2 were not empty, and the first one was unshared. In that case it would add the new elements in place, hence modifying its input. THIS IS VERY BAD!

Fixed now in 8-5-branch and HEAD.
Log in (anonymous is fine) to add a comment.