Skip to content
Tcl Source Code History Of Ticket 781585ffffffffff
Login

History Of Ticket 781585ffffffffff

Artifacts Associated With Ticket 781585ffffffffff

  1. Ticket change [ea3c58cde5] (rid 103331) by effevi on 2003-08-01 16:22:25:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      This small program show something wrong on 8.4.4 against 
      8.3.3. Try as is on 8.4.4 and the do the same uncommenting 
      the append statement. 
       
      #!/usr/bin/tngsh 
      set buffout [string repeat x 3000000] 
      proc goappend {} { 
      global buffout 
      switch x { 
      x { 
      append buffout "1" 
      } 
      } 
      # 
      # uncomment this line to see the code much more slower !! 
      # 
      #append buffout "x" 
      # 
      return 1 
      } 
       
      for {set i 0} {$i < 3000} {incr i} { 
      goappend 
      puts "append $i" 
      } 
       
      
    4. foundin initialized to: "obsolete: 8.4.4"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "effevi"
    9. subsystem initialized to: "20. [interp]"
    10. title initialized to: "Interpreter 10 time slower then 8.3.3"
    11. type initialized to: "Bug"
  2. Ticket change [2075308e8e] (rid 91311) by msofer on 2003-08-02 09:30:44:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Verified in 8.4.3 and 8.4.2 too. The following script
      isolates a bit the probable causes:
        - [switch] is innocent; what seems to cause the problem is
      that append is called "mixed" (once bytecompiled, once invoked)
         - it is not obvious that it is caused by the new variable
      tclObjTypes (but they remain a prime suspect tomy eyes)
         - [global] is innocent, although it is important that
      this a global variable. The behaviour is identical if we use
      [global buffout] instead of the fully qualified name ::buffout
      
      set buffout [string repeat x 300000] 
      proc goappend {w} { 
          set append append
          if {$w == 0} {
      $append ::buffout "1"
      $append ::buffout "1" 
          } elseif {$w == 1} {
      $append ::buffout "1"
      append ::buffout "1"
          } else {
      append ::buffout "1"
      append ::buffout "1"
          }
      } 
      puts [info patch]
      puts [time {goappend 0} 3000]
      puts [time {goappend 1} 3000]
      puts [time {goappend 2} 3000]
      
      Output:
      
      8.4.3
      13 microseconds per iteration
      2273 microseconds per iteration
      11 microseconds per iteration
      
      8.4.2
      8 microseconds per iteration
      2231 microseconds per iteration
      7 microseconds per iteration
      
      8.3.4
      13 microseconds per iteration
      13 microseconds per iteration
      12 microseconds per iteration
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. subsystem changed to: "47. Bytecode Compiler"
    5. username: "msofer"
  3. Ticket change [ee115970b2] (rid 104018) by dkf on 2003-08-03 21:49:48:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Noting here that the specific example listed should go much
      faster in 8.5 where the mode will no longer be mixed (BCCed
      "switch" applies), not that that means we don't have a problem.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  4. Ticket change [814ea7a030] (rid 117009) by dkf on 2003-08-05 05:56:02:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Behaviour looks linear in initial list size, and is not
      dependent on shimmering strings to append.  :^(
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [81c929f64d] (rid 117107) by dkf on 2003-08-05 06:33:15:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      How bizarre can you get?
      
      proc goappend {w} {
          set appen append
          if {$w==0} {
              append ::buffout z;$appen ::buffout z
          } else {
              $appen ::buffout z;append ::buffout z
          }
      }
      puts [time {goappend 0} 2000]  ;# => 7 microseconds 
      puts [time {goappend 1} 2000]  ;# => 892 microseconds
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  6. Ticket change [6f08f25ff9] (rid 100241) by dkf on 2003-08-05 06:39:38:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Hmm.  Minor error, but problem still there...
      % set buffout [string repeat x 5000];time {goappend 0} 1000
      8 microseconds per iteration
      % set buffout [string repeat x 5000];time {goappend 1} 1000
      157 microseconds per iteration
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  7. Ticket change [5c506629e5] (rid 115279) by hobbs on 2003-08-05 06:40:08:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      On Win2K/P4 2.4ghz I get:
      
      (tkcon) 55 % time {set ::buffout ""; goappend 0} 2000
      5 microseconds per iteration
      (tkcon) 55 % time {set ::buffout ""; goappend 1} 2000
      6 microseconds per iteration
      
      and
      
      (tkcon) 58 % time {set ::buffout [string repeat x 5000]; 
      goappend 0} 2000
      238 microseconds per iteration
      (tkcon) 58 % time {set ::buffout [string repeat x 5000]; 
      goappend 1} 2000
      239 microseconds per iteration
      
      So unless a better example is provided, I don't see the issue.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  8. Ticket change [c7b99cc57e] (rid 121990) by dkf on 2003-08-05 06:48:15:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      There's still something there in 8.4.4 though the overall
      performance is significantly better (or maybe the test
      machine is better :^/)
      
      % info patch
      8.4.4
      % proc goappend {w} {
          set appen append
          if {$w==0} {
              append ::buffout z;$appen ::buffout z
          } else {
              $appen ::buffout z;append ::buffout z
          }
      }
      % set buffout [string repeat x 50000];time {goappend 0} 10000
      10 microseconds per iteration
      % set buffout [string repeat x 50000];time {goappend 1} 10000
      261 microseconds per iteration
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  9. Ticket change [9022d73319] (rid 120396) by dkf on 2003-08-05 07:17:47:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=79902
      
      Bytecodes look reasonable.  I'm out of my depth!
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. username: "dkf"
  10. Ticket change [7a912e093b] (rid 90347) by pspjuth on 2003-08-05 07:20:41:

    1. icomment:
      Logged In: YES 
      user_id=98900
      
      My theory is that there is a lingering object
      reference to the first append's result, causing
      an object duplication in the second append.
      
      By invoking any non byte compiled command between
      the appends, it works.
      
      proc goappend {w} { 
          set append append
          if {$w == 0} {
              $append ::buffout x
              append  ::buffout x
          } elseif {$w == 1} {
              $append ::buffout x
              string range a 0 0
              append ::buffout x
          } else {
              $append ::buffout x
              string index a 0
              append ::buffout x
          }
      } 
      puts [info patch]
      set buffout [string repeat x 30000] 
      puts [time {goappend 0} 5000]
      set buffout [string repeat x 30000] 
      puts [time {goappend 1} 5000]
      set buffout [string repeat x 30000] 
      puts [time {goappend 2} 5000]
      
      8.5a0
      249.5 microseconds per iteration
      10.8 microseconds per iteration
      244.5 microseconds per iteration
      
      
      
    2. login: "pspjuth"
    3. mimetype: "text/plain"
    4. username: "pspjuth"
  11. Ticket change [63ecf65189] (rid 92661) by dkf on 2003-08-05 15:44:14:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Yuck-o! The extra reference is actually the interpreter
      result.  :^/
      Adding a Tcl_ResetResult(interp) to the INST_POP instruction
      (pick your own obvious spot) results in no (new) Tcl tests
      failing and the following (with Peter Spjuth's goappend)
      performance data:
        % set buffout [string repeat x 30000] ;puts [time
      {goappend 0} 5000]
        15 microseconds per iteration
        % set buffout [string repeat x 30000] ;puts [time
      {goappend 1} 5000]
        26 microseconds per iteration
        % set buffout [string repeat x 30000] ;puts [time
      {goappend 2} 5000]
        22 microseconds per iteration
      I'm not sure what the overall performance implications of
      doing this are though, so perhaps a more focussed fix would
      be better?
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "7 High"
    5. username: "dkf"
  12. Ticket change [34ffa08f9d] (rid 106840) by msofer on 2003-08-05 23:03:26:

    1. resolution changed to: "Fixed"
    2. status changed to: "Closed"
  13. Ticket change [22077bfb4d] (rid 130686) by msofer on 2003-08-05 23:03:27:

    1. closedate changed to: "2003-08-05T16:03:27"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Thanks everybody for the analysis; fixed in HEAD and
      tcl-core-8-4-branch
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. username: "msofer"