Tcl_GetBooleanFromObject performance
Closed / Fixed472576ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 24 years ago
Descriptionplain2001-10-18 21:50:33
Tcl_GetBooleanFromObj (and SetBooleanFromAny) have the anomaly that they don't check for an
object that is already of the correct type: instead, they reparse strings on each trip through.
Moreover, they could be sped up still further by having Tcl_GetBooleanFromObj recognize at least
tclIntType and tclLongType, and doing the obvious int-to-Boolean conversion.
Code that shows the performance anomaly:
% time { set i 100000 ; while { true && [incr i -1] > 0 } {} }
392272 microseconds per iteration
% time { set i 100000 ; while { 1 && [incr i -1] > 0 } {} }
293493 microseconds per iteration
msofer Closed ticket [472576ffff].
[History diff]2002-08-08 00:12:39
Log in (anonymous is fine) to add a comment.