Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5f60e4479926227bcdaa0e56d87703d2aa06c319
Ticket: 2992970fffffffffffffffffffffffffffffffff
Slow performance of [append]
User & Date: dgp on 2014-01-15 18:11:14
Changes

  1. closedate changed to: "2456673.25780767"
  2. closer changed to: "dgp"
  3. icomment:
    Postscript on this bug fix.
    
    The creation of the new routine TclAppendBytesToByteArray()
    that includes a smart(er) bytearray growth algorithm was
    effective in restoring efficient appends to pure bytearrays; Yay!
    
    As a minor point though, there is a comment in the part of
    Tcl_AppendObjToObj() that handles this case to the effect
    that you can reliably depend on
    
        Tcl_AppendObjToObj(x, x);
    
    to work.  The new implementation does not in fact preserve
    that guarantee.  Specifically on the current trunk, the
    value of bytesSrc passed to TABTBA() is at risk of becoming
    invalid by the time it is used, due to reallocs that TABTBA
    might perform.
    
    Now in a Copy On Write system like Tcl has, I can't imagine
    when anyone would want to call
    
        Tcl_AppendObjToObj(x, x);
    
    I cannot find any way to induce any of the existing T_AOTO()
    calls in the Tcl sources to attempt it, and that likely explains
    why the test suite doesn't cover the possibility.
    
    My preference is to remove the (now false) comment, and possibly
    even add a panic detecting any attempt to append a value to itself
    declaring it to be a CoW violation.  Any reason not to do that?
    
  4. login: "dgp"
  5. mimetype: "text/plain"
  6. severity changed to: "Minor"