Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f65582416a25dd581eb822ca62ee47d9e1b00077
Ticket: 218487ffffffffffffffffffffffffffffffffff
tcl8.0p2 is 10x faster than tcl8.0.3: performance bug when
User & Date: nobody on 2000-10-26 01:01:09
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 702 Bug
    Version: 8.0.3
    SubmitDate: '1998-10-09'
    LastModified: '2000-02-05'
    Severity: SER
    Status: Released
    Submitter: admin
    ChangedBy: hobbs
    OS: All
    OSVersion: NA
    Machine: NA
    FixedDate: '2000-02-05'
    FixedInVersion: 8.2
    ClosedDate: '2000-10-25'
    
    
    I have done some further testing related to this performance problem.
    
    I have attempted to remove code and narrow down the problem - so far I have
    disconvered that one procedure in particular is taking ages (like 10-20
    times than before):
    See below... proc get_raw_token
    
    I have also downloaded the source release and compiled this on my Linux box,
    running the same application it is also extremely slow compared to the 8.0p2
    release!
    
    # include special handling for tokens and separators
    # if processing ALPHA then get separator -> end of token
    # if processing NUMBER then get separator -> end of token
    # if processing SEPARATOR then test for next char?? only <= >= <> != ??
    # note: this processing is handled semi-automatically by "string
    wordstart/end"
    
    proc get_raw_token {} {
        global file_source file_source_pos file_source_line
    
        while 1 {
     set start [string wordstart $file_source $file_source_pos]
     set end [expr {[string wordend $file_source $file_source_pos] - 1}]
    
     # null? assume end of file
     if {$end < $file_source_pos} { return "//eof" }
    
     set file_source_pos [expr {$end + 1}]
     set token [string range $file_source $start $end]
    
     # comments? search until end of the line
     if {$token == "/"} {
         if {[string range $file_source $file_source_pos $file_source_pos] ==
    "/"} {
      while {[string range $file_source $file_source_pos $file_source_pos] >= "
    "} {
          incr file_source_pos
      }
         }
     } elseif {$token == "'"} {
         while {[string range $file_source $file_source_pos $file_source_pos] !=
    "'"} {
      incr file_source_pos
         }
         # skip final quote character
         set end $file_source_pos
         incr file_source_pos
         # return string, including quote characters
         return [string range $file_source $start $end]
     } elseif {$token == "\""} {
         while {[string range $file_source $file_source_pos $file_source_pos] !=
    "\""} {
      incr file_source_pos
         }
         # skip final quote character
         set end $file_source_pos
         incr file_source_pos
         # return string, including quote characters
         return [string range $file_source $start $end]
     } elseif {$token == "\n"} { incr file_source_line
     } elseif {$token > " "} { return $token }
        }
    }
    
    Peter Campbell wrote:
    
    > I have upgraded from Tcl8.0p2 on Win95 to 8.0.3 - downloaded the binary
    > distribution for both.
    >
    > My application which is a compiler/translator now runs 10-20 times
    > slower than before.
    >
    > I had also run my application on Linux using Tcl7.6 and on Linux using
    > itcl3.0a1 with Tcl8.0. The performance was good, I have not yet tried my
    > application on Linux using the new Tcl8.0.3.
    >
    > Has anybody else experienced any performance problems?
    > I have reported this problem to Scriptics as it also effected their
    > "prowish" program.
    >
    > Does anyone involved with the source code of Tcl know what has changed
    > to effect performance to this extreme from 8.0p2 to 8.0.3?
    >
    > I thought it may be to do with source files being re-"compiled"
    > constantly or something??
    > I do not use any extensions as yet, the program uses file access -
    > mainly reading small (5-10k) files into a string then processing them
    > using the string commands.
    >
    > HELP...
    
    
    The problem was due to an optimization that was removed because it
    wasn't 100% correct, which was later reinstated with full correctness
    (at least in 8.2, may be earlier).  All the user has to do is:
    
        while {1}
    
    instead of
    
        while 1
    
    to get the speed back.  This is pedantically correct, but as I said,
    the optimization was also reinstated later.  The algorithm itself
    could be significantly improved. 
    -- 02/05/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.0.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "10. Objects"
  10. title changed to:
    tcl8.0p2 is 10x faster than tcl8.0.3:  performance bug when 
    
  11. type changed to: "Bug"