Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6ecfe7e77f2ea45602a404eea81a13c6c42e82f7
Ticket: 1767293fffffffffffffffffffffffffffffffff
Bad performance using ** operator with integer operands
User & Date: kennykb on 2007-08-07 05:36:58
Changes

  1. icomment:
    Logged In: YES 
    user_id=99768
    Originator: NO
    
    On Win32 (mingw), the patch is observed to fix the performance anomaly:
    
    % time {expr {5*5}} 100000
    0.63991 microseconds per iteration
    % time {expr {5**2}} 100000
    0.62671 microseconds per iteration
    % time {expr {pow(5,2)}} 100000
    1.68862 microseconds per iteration
    % time {expr {5*5*5*5*5}} 100000
    0.91689 microseconds per iteration
    % time {expr {5**5}} 100000
    0.72139 microseconds per iteration
    % time {expr {pow(5,5)}} 100000
    1.65471 microseconds per iteration
    
    The performance penalty is still there when quantities overflow from a 32-bit integer; we're still working on that one:
    
    % time {expr {3**19}} 100000; # this fits in a 32-bit word
    0.61131 microseconds per iteration
    % time {expr {3**20}} 100000; # this doesn't
    5.84269 microseconds per iteration
    
    
    
    
  2. login: "kennykb"
  3. mimetype: "text/plain"
  4. username: "kennykb"