Skip to content
Tcl Source Code History Of Ticket 1179320
Login

History Of Ticket 1179320

Artifacts Associated With Ticket 1179320

  1. Ticket change [6eaf259118] (rid 100189) by nobody on 2005-04-08 16:30:56:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      In a number of cases in the core there are places where 
      multiple temporary buffers are separately ckalloc'd, 
      used, then separately ckfree'd. These could be rolled 
      into a single larger buffers which are then subdivided.
      Not a great win, but it is faster.
      
      eg. tclCmdAH.c
      
      1705d1704
      <     char *allocbuf = NULL;
      1740,1747c1739,1743
      <       const size_t sz1 = numLists * sizeof(int);
      <       const size_t sz2 = numLists * sizeof(Tcl_Obj **);
      <       allocbuf = (char *)ckalloc(3*sz1 + 2*sz2);
      <       index    = (int *) allocbuf;
      <       varcList = (int *)      ((char *)allocbuf + sz1);
      <       varvList = (Tcl_Obj **) ((char *)varcList + sz1);
      <       argcList = (int *)      ((char *)varvList + sz2);
      <       argvList = (Tcl_Obj **) ((char *)argcList + sz1);
      ---
      >       index = (int *) ckalloc(numLists * sizeof(int));
      >       varcList = (int *) ckalloc(numLists * sizeof(int));
      >       varvList = (Tcl_Obj ***) ckalloc(numLists * sizeof
      (Tcl_Obj **));
      >       argcList = (int *) ckalloc(numLists * sizeof(int));
      >       argvList = (Tcl_Obj ***) ckalloc(numLists * sizeof
      (Tcl_Obj **));
      1869c1865,1869
      <       ckfree((char *) allocbuf);
      ---
      >       ckfree((char *) index);
      >       ckfree((char *) varcList);
      >       ckfree((char *) argcList);
      >       ckfree((char *) varvList);
      >       ckfree((char *) argvList);
      
      Admittedly this is not a common code path.
      
      A similar change can be used in:
      
      a) tclCmdMZ.c at lines ~1922 (string map) to reduce 2 
      or 3 ckalloc's down to 1.
      
      b) tclCompCmds.c:
       line ~687 for var[cv]list
      
      c) tclCompCmds.c
      line ~2933 for fixupArray and fixupTargetArray
      
      
      
      Would save a few cycles.
      
      
      
      
      
    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: "16. Commands A-H"
    10. title initialized to: "Small code optimisation...."
    11. type initialized to: "Patch"
  2. Ticket change [8eb30f3031] (rid 120157) by msofer on 2005-04-09 03:08:28:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Just remarking that (in 8.5) memory allocations that have
      the lifetime of a command can (and should?) use
      TclStackAlloc / TclStackFree. These allocate memory from
      Tcl's execution stack.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [554fb2fc54] (rid 94114) by dkf on 2005-04-09 05:04:00:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=79902
      
      Feels like a low priority fix to me; assigning to someone
      who cares more about doing minor opts than I do.
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. priority changed to: "2"
    6. username: "dkf"
  4. Ticket change [a60c172bc1] (rid 98530) by nobody on 2008-01-09 01:36:29:

    1. icomment:
      Logged In: NO 
      
      "/software/packages"=pkg_repl("perl-DBD-Pg","1.31-6","i386");
      
      
    2. login: "[email protected]"
    3. mimetype: "text/plain"
    4. username: "[email protected]"
  5. Ticket change [7dc76973be] (rid 148248) by dkf on 2016-07-24 18:04:33:

    1. assignee changed to: "dkf"
    2. closer changed to: "nobody"
    3. comment changed to:
      In a number of cases in the core there are places where 
      multiple temporary buffers are separately ckalloc'd, 
      used, then separately ckfree'd. These could be rolled 
      into a single larger buffers which are then subdivided.
      Not a great win, but it is faster.
      
      eg. tclCmdAH.c
      
      1705d1704
      <     char *allocbuf = NULL;
      1740,1747c1739,1743
      <       const size_t sz1 = numLists * sizeof(int);
      <       const size_t sz2 = numLists * sizeof(Tcl_Obj **);
      <       allocbuf = (char *)ckalloc(3*sz1 + 2*sz2);
      <       index    = (int *) allocbuf;
      <       varcList = (int *)      ((char *)allocbuf + sz1);
      <       varvList = (Tcl_Obj **) ((char *)varcList + sz1);
      <       argcList = (int *)      ((char *)varvList + sz2);
      <       argvList = (Tcl_Obj **) ((char *)argcList + sz1);
      ---
      >       index = (int *) ckalloc(numLists * sizeof(int));
      >       varcList = (int *) ckalloc(numLists * sizeof(int));
      >       varvList = (Tcl_Obj ***) ckalloc(numLists * sizeof
      (Tcl_Obj **));
      >       argcList = (int *) ckalloc(numLists * sizeof(int));
      >       argvList = (Tcl_Obj ***) ckalloc(numLists * sizeof
      (Tcl_Obj **));
      1869c1865,1869
      <       ckfree((char *) allocbuf);
      ---
      >       ckfree((char *) index);
      >       ckfree((char *) varcList);
      >       ckfree((char *) argcList);
      >       ckfree((char *) varvList);
      >       ckfree((char *) argvList);
      
      Admittedly this is not a common code path.
      
      A similar change can be used in:
      
      a) tclCmdMZ.c at lines ~1922 (string map) to reduce 2 
      or 3 ckalloc's down to 1.
      
      b) tclCompCmds.c:
       line ~687 for var[cv]list
      
      c) tclCompCmds.c
      line ~2933 for fixupArray and fixupTargetArray
      
      
      
      Would save a few cycles.
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. severity changed to: "Minor"