Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6b5bd41b54e09f28f7079de921d3225cf09b877a
Ticket: 644819ffffffffffffffffffffffffffffffffff
Bytecompiled [switch] Command
User & Date: dkf on 2002-11-28 21:57:27
Changes

  1. icomment:
    
    
    File Deleted - 36315: 
    
    
    
    File Added - 36392: compiled_switch.patch
    
    Logged In: YES 
    user_id=79902
    
    Apart from the points Jeff raises (and which should be
    addressed by the new patch below), there were a great number
    of problems (relocation fixups and max stack depths were
    both broken!)
    
    (BTW, INST_STR_MATCH wasn't a straight slot-in replacement
    for INST_STR_EQ because it matters which argument is which. 
    INST_OVER is our savour!)
    
    Performance wise on a 700MHz P3 Linux box:
    % proc foo s {
        set x 0; set y 0
        foreach c [split $s {}] {
            switch -exact -- $c {
                a {incr x}
                b {incr y}
            }
        }
        return $x,$y
    }
    % proc bar s {
        set x 0; set y 0
        foreach c [split $s {}] {
            switch -exact -- $c a {incr x} b {incr y}
        }
        return $x,$y
    }
    % time {foo
    shdgsdbcbcsjdsbvbsdjfvbsdbvsldfgsdfsvbsdhfbvlsdvsdbvldvxnvascv}
    1000
    275 microseconds per iteration
    % time {bar
    shdgsdbcbcsjdsbvbsdjfvbsdbvsldfgsdfsvbsdhfbvlsdvsdbvldvxnvascv}
    1000
    328 microseconds per iteration
    
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. username: "dkf"