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

  1. #
  2. # Test of performance "regression" by wide-int only 8.7th (for 32 bit):
  3. #
  4. # Here are calibrated artifical tests of following expression:
  5. #
  6. # 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}}
  7. #
  8. # 8.6: 0.528777 µs/# 2051649 # 1891157 #/sec 1084.864 nett-ms
  9. # 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')
  10. # 8.7-wide: 0.794470 µs/# 1496466 # 1258701 #/sec 1188.897 nett-ms (8.7 current)
  11. #
  12. # 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}}`
  13. # with measured overhead of 0.251 µs for 8.6 and 0.275 µs for 8.7 (in both variants).
  14. #
  15. # Test script:
  16.  
  17. proc test {} {
  18. set i 3;
  19. puts Calibrate:[tcl::unsupported::timerate -calibrate {expr {$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i+$i}}];
  20. time {
  21. 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]
  22. } 3
  23. }; test
  24.