Overview
| Artifact ID: | 726b73da1c1407998ce56d1689085f46c4ed961d |
|---|---|
| Ticket: | 1158008fffffffffffffffffffffffffffffffff
new list internal rep |
| User & Date: | msofer on 2005-03-07 01:05:59 |
Changes
- assignee changed to: "kennykb"
- cmimetype changed to: "text/plain"
- comment changed to:
Attached a patch against HEAD that changes the internal reps of objects. The changes are: (1) The List struct is now growable and contains the pointers to the list elements at the end. This reduces the number of mallocs in list creation from 2 to 1. (2) The List struct is now refcounted. This permits insuring that the pointers to the list elements survive a possible shimmering of the object (by increasing the ref count). This is now use in Tcl_EvalObjEx (pure list opt) and TclLsetList (so that it calls TclLsetFlat) (3) All empty lists in a thread share the same List internal rep. In this manner, an empty list can be allocated and reserved without any malloc/free calls The patch passes the testsuite. It has not been tested for leaks yet. There shouldn't be any ... CAVEAT: callers of Tcl_ListObjGetElements should *not* change the elements, even if the Tcl_Obj is unshared (as its internal rep may be shared). This was IMO already an abuse of the api, but it is valid in the unpatched implementation and invalid with the patch. The docs are silent about this; they do not even mention that the Tcl_Obj should not be shared for an edit to be valid. Maybe throw some new CONST into that api?
- foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "msofer"
- subsystem changed to: "14. List Object"
- title changed to: "new list internal rep"
- type changed to: "Patch"