Skip to content
Tcl Source Code History Of Ticket 1990276
Login

History Of Ticket 1990276

Artifacts Associated With Ticket 1990276

  1. Ticket change [755e5e0ae2] (rid 105378) by patthoyts on 2008-06-10 23:10:41:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      I'm testing out adding a state option to the binary encode functions to make it simpler to write channels that use these functions. The -state option takes a variable name. In the C code we therefore get a bytearray object passed in via the objv array and may also get another object passed via name.
      I get a 10x faster calling time using the pass-by-name.
      
      % proc t1 {} {variable data; binary encode hex $data}
      % proc t2 {} {variable data; binary encode hex -state data ""}
      % set data [binary format @102400] ; string length [t1]
      204800
      % set data [binary format @102400] ; string length [t2]
      204800
      % set data [binary format @102400] ; time {t1} 10
      1755.9 microseconds per iteration
      % set data [binary format @102400] ; time {t2} 10
      218.6 microseconds per iteration
      
      !!!!!
      
      The C function accesses these Tcl_Obj's using:
          data = input = Tcl_GetByteArrayFromObj(objv[objc-1], &count);
          if (stateObj) {
      data = state = Tcl_GetByteArrayFromObj(stateObj, &state_count);
      count += state_count;
          }
      and then I move the 'data' pointer along the state data first then the input data. So the C code is identical for each calling method.
      
      You can see the full function at http://paste.tclers.tk/973
      
      
      
      
    4. foundin initialized to: "obsolete: 8.6a0"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "patthoyts"
    10. subsystem initialized to: "07. Variables"
    11. title initialized to: "Surprising differences in variable access speed."
    12. type initialized to: "Bug"
  2. Ticket change [db8449028c] (rid 107975) by msofer on 2008-06-12 03:49:25:

    1. closedate changed to: "2008-06-11T20:49:25"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      Originator: NO
      
      This is a bug in the interpretation of the timing script: [t2] will reset $data to {} after the first run, so that the remaining 9 runs are done on empty data.
      
      Proper timing gives
      
      % proc t1 {} {variable data; binary encode hex $data}
      % proc t2 {} {variable data; binary encode hex -state data ""}
      % set data0 [binary format @102400]; string length $data0
      102400
      % time {set data $data0; t1} 10
      1032.5 microseconds per iteration
      % time {set data $data0; t2}
      1010 microseconds per iteration
      
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Rejected"
    7. status changed to: "Closed"
    8. username: "msofer"