Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 84c5a6d30d067b3c369074e9b9aac60d063e2ccf
Ticket: 1767293fffffffffffffffffffffffffffffffff
Bad performance using ** operator with integer operands
User & Date: egavilan on 2007-08-03 19:53:50
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    When using integers with ** operand, the speed is considerably slower than if using at least one float argument.
    
    After a few runs, I get consistenly these results:
    
    % time {expr {5.0**2}} 10000
    3.6763 microseconds per iteration
    % time {expr {5**2.0}} 10000
    3.6791 microseconds per iteration
    % time {expr {double(5)**2}} 10000
    5.4605 microseconds per iteration
    % time {expr {5**double(2)}} 10000
    5.693 microseconds per iteration
    % time {expr {5**2}} 10000
    38.9746 microseconds per iteration
    
    just to compare with the other "traditional" ways to obtain 5**2
    
    % time {expr {5*5}} 10000
    2.7841 microseconds per iteration
    % time {expr {pow(5,2)}} 10000
    7.7954 microseconds per iteration
    
    % info patchlevel
    8.5a6
    
    
    
  4. foundin changed to: "obsolete: 8.5a6"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "egavilan"
  10. subsystem changed to: "45. Parsing and Eval"
  11. title changed to:
    Bad performance using ** operator with integer operands
    
  12. type changed to: "Bug"