Posted to tcl by sebres at Tue Feb 05 17:24:41 GMT 2019view pretty

#
# Test of performance "regression" by wide-int only 8.7th (for 32 bit): 
# 
# Here are calibrated artifical tests of following expression:
# 
# timerate {expr {$i**2+$i**3+$i**4+$i**5+$i**6+$i**7+$i**8+$i**9+$i**10+$i**11+$i**12+$i**13+$i**14+$i**15+$i**16}}
#
#   8.6:      0.528777 µs/# 2051649 # 1891157 #/sec 1084.864 nett-ms
#   8.7-int:  0.530040 µs/# 2047298 # 1886649 #/sec 1085.150 nett-ms (8.7 before [4f6d4a2b15], TIP 484: Merge 'int' and 'wideInt' Obj-type to a single 'int')
#   8.7-wide: 0.794470 µs/# 1496466 # 1258701 #/sec 1188.897 nett-ms (8.7 current)
#
# All tests are executed in proc, calibration was made using overhead of `{expr {$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i}}`
# with measured overhead of 0.251 µs for 8.6 and 0.275 µs for 8.7 (in both variants).
#
# Test script:

proc test {} {
  set i 3;
  puts Calibrate:[tcl::unsupported::timerate -calibrate {expr {$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i}}];
  time {
    puts [tcl::unsupported::timerate {expr {$i**2+$i**3+$i**4+$i**5+$i**6+$i**7+$i**8+$i**9+$i**10+$i**11+$i**12+$i**13+$i**14+$i**15+$i**16}} 1600]
  } 3
}; test