Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: aad5e8e047d8917e3752a5a31500ae30329d2401
Ticket: 2992970fffffffffffffffffffffffffffffffff
Slow performance of [append]
User & Date: jgodfrey on 2010-04-28 04:05:14
Changes

  1. icomment:
    Alex,
    
    I'm unfamiliar with /dev/zero, but some Googling indicates that it just returns zeros when read.  With that in mind, I changed 2 lines of your "ap" proc and commented out a third - so it looks like this:
    
    proc ap {} {
        global sample
        #set z [open /dev/zero r]
        set z [string repeat 0 130]
        #fconfigure $z -translation binary
        for {set i 0} {$i<100000} {incr i} {
    foreach l $sample {
        #append buffer [read $z $l]
            append buffer [string range $z 0 $l]
    }
        }
        puts "Total size: [string length $buffer]"
    }
    
    The 3 commented lines are your originals.  As I'm not sure what you're trying to test here, I can't say whether the above is still an equivalent test or not.  If you're just testing a bunch of chunked [append] calls, I guess it's OK?  Though I'm thinking if the above were valid, you probably wouldn't have used /dev/zero in the first place...  Let me know.
    
    Anyway, I don't see any huge differences between 8.5.8 and 8.6b1.1 in my Win7 64 environment, though 8.6 is slower as shown below.
    
    Total size: 242500000
    7259428 microseconds per iteration
    (Desktop) 1 % set tcl_patchLevel
    8.6b1.1
    
    Total size: 242500000
    6162242 microseconds per iteration
    (Desktop) 1 % set tcl_patchLevel
    8.5.8
    
    
    
  2. login: "jgodfrey"
  3. mimetype: "text/plain"
  4. username: "jgodfrey"