Skip to content
Tcl Source Code History Of Ticket 1246897
Login

History Of Ticket 1246897

Artifacts Associated With Ticket 1246897

  1. Ticket change [f5add77efe] (rid 130155) by nobody on 2005-07-28 16:11:31:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Minor optimisation: there are a few calls to 
      Tcl_DStringAppend with fixed strings, but give a length 
      of -1. Replacing the -1 with the actual length (as is done 
      in other places) would save a strlen.
      eg.
      
      
      tclConfig.c:141:    Tcl_DStringAppend 
      (&cmdName, "::",          -1);
      tclConfig.c:161:    Tcl_DStringAppend 
      (&cmdName, "::pkgconfig", -1);
      tclInterp.c:433:    Tcl_DStringAppend(&script, "lsearch -
      exact", -1);
      tclInterp.c:437:    Tcl_DStringAppend(&script, " [file join 
      [info library] encoding]", -1);
      tclInterp.c:450:    Tcl_DStringAppend(&script, "file join 
      [info library] encoding", -1);
      tclUtil.c:1856:Tcl_DStringAppend(dsPtr, " {", -1);
      tclUtil.c:1858:Tcl_DStringAppend(dsPtr, "{", -1);
      tclUtil.c:1885:    Tcl_DStringAppend(dsPtr, "}", -1);
      
      There are also some where the string being copied is a 
      Tcl_DString, so we could use the corresponding 
      Tcl_DStringLength instead of -1; again saving a strlen.
      
      eg.
      
      tclLoad.c:349:Tcl_DStringAppend(&initName, 
      Tcl_DStringValue(&pkgName), -1);
      tclLoad.c:351:Tcl_DStringAppend
      (&safeInitName, Tcl_DStringValue(&pkgName), -1);
      tclLoad.c:353:        Tcl_DStringAppend(&unloadName, 
      Tcl_DStringValue(&pkgName), -1);
      tclLoad.c:355:        Tcl_DStringAppend
      (&safeUnloadName, Tcl_DStringValue(&pkgName), -1);
      tclNamesp.c:823:Tcl_DStringAppend(&buffer1, 
      Tcl_DStringValue(&buffer2), -1);
      tclNamesp.c:826:Tcl_DStringAppend(&buffer2, 
      Tcl_DStringValue(&buffer1), -1);
      
      (which makes me wonder if the Right Thing is done if 
      any of the above contain embedded NULs in them, as 
      the strlen will give the 'incorrect' length.).
      
      
      Final point, wouldn't the copy loop in Tcl_DStringAppend 
      be quicker as a memcpy and not as a character by 
      character copy in the for loop. I've no empirical evidence, 
      just the (perhaps incorrect!) assumption that the C 
      library's memcpy is quicker than the corresponding for 
      loop. 
      
      Cheers!
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "None"
    10. title initialized to: "Minor optimsations for Tcl_DStringAppend usage."
    11. type initialized to: "Patch"
  2. Ticket change [66b75609dc] (rid 102765) by dkf on 2005-07-28 23:25:57:

    1. assignee changed to: "dgp"
    2. priority changed to: "4"
  3. Ticket change [d509efaf11] (rid 123548) by dgp on 2005-07-29 04:32:13:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      there's no patch here?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [1b89fa6e45] (rid 123170) by dgp on 2005-07-29 05:04:06:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      The docs aren't explicit about it
      (perhaps because they are so old),
      but I don't believe the Tcl_DString*
      routines were ever intended to
      support embedded NUL bytes within
      the dynamic strings.
      
      The comment on the "length" field
      of the Tcl_DString struct (in tcl.h)
      reads:
      
        Number of non-NULL characters in the string
      
      That said, it's clear that callers of
      Tcl_DStringAppend() and
      Tcl_DStringSetLength() could leave
      NUL bytes within the "length" of the
      string.
      
      Wise or not, the Tcl_DString* routines
      are fairly low level and have a long
      history of exposing that capability.
      If it gets too troubling, just make use
      of Tcl_Obj's for your dynamically
      sized string values.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. priority changed to: "3 Low"
    5. username: "dgp"
  5. Ticket change [d2fa4dce85] (rid 113615) by dkf on 2005-07-29 15:56:11:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      The encoding subsystem relies on the fact that DStrings can
      hold NUL bytes.
      
      The DString system serves multiple purposes, some of which
      are obsolete these days. It is both a way of having safely
      managed buffers and a mechanism for doing some string
      manipulations that was heavily used back in Tcl 7.* (and
      before?) but which has been largely superceded for this
      latter purpose these days by the Tcl_Obj system.
      
      I'm fairly strongly inclined to leave things as they are
      unless the code in question is on some performance critical
      path: easier maintenance beats shaving a few nanoseconds
      from a location where it will get swamped by some syscall...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  6. Ticket change [8186dbb15e] (rid 117054) by dgp on 2005-08-13 09:12:27:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      The fixed string arguments should
      continue to be paired with -1 arguments,
      for ease of maintenance when the fixed
      string might be changed.
      
      When copying DStrings, I agree we'd be
      better off passing in the DStringLength
      rather than -1.
      
      The memcpy seems reasonable to me.
      
      I'd happily accept a patch along those lines.
      Separate patches for both 8.5 and 8.4 lines
      would be even better.
      
      Thanks.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. status changed to: "Pending"
    5. username: "dgp"
  7. Ticket change [525cd5395c] (rid 126305) by dgp on 2005-08-13 09:12:28:

    1. closedate changed to: "2005-08-13T02:12:28"
    2. closer changed to: "dgp"
  8. Ticket change [d34bdd5fd5] (rid 123268) by sf-robot on 2005-08-27 09:20:35:

    1. closedate changed to: "2005-08-27T02:20:35"
    2. closer changed to: "sf-robot"
    3. icomment:
      Logged In: YES 
      user_id=1312539
      
      This Tracker item was closed automatically by the system. It was
      previously set to a Pending status, and the original submitter
      did not respond within 14 days (the time period specified by
      the administrator of this Tracker).
      
      
    4. login: "sf-robot"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "sf-robot"