vendredi 1 mai 2015

tcl non curly braces expression slower than with them?

I have noticed something. Let's look at two codes bit. in 1, if is not input with a curly brace input, the other is. The curly braced 1 is slightly faster. Why?
See codes and outputs below:

puts [ time { if { [ expr { 5 % 2 } ] } { puts 1 } else { puts 2 } } ]
1
52 microseconds per iteration
puts [ time { if [ expr { 5 % 2 } ] { puts 1 } else { puts 2 } } ]
1
54 microseconds per iteration

The differences are stable. 2 microseconds faster when using more code characters.
Why?

Aucun commentaire:

Enregistrer un commentaire