if.bm 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. (define-module (benchmarks if)
  2. :use-module (benchmark-suite lib))
  3. (with-benchmark-prefix "if-<expr>-then-else"
  4. (benchmark "executing then" 330000
  5. (if (quote #t) #t #f))
  6. (benchmark "executing else" 330000
  7. (if (quote #f) #t #f)))
  8. (with-benchmark-prefix "if-<expr>-then"
  9. (benchmark "executing then" 330000
  10. (if (quote #t) #t))
  11. (benchmark "executing else" 330000
  12. (if (quote #f) #t)))
  13. (with-benchmark-prefix "if-<iloc>-then-else"
  14. (let ((x #t))
  15. (benchmark "executing then" 330000
  16. (if x #t #f)))
  17. (let ((x #f))
  18. (benchmark "executing else" 330000
  19. (if x #t #f))))
  20. (with-benchmark-prefix "if-<iloc>-then"
  21. (let ((x #t))
  22. (benchmark "executing then" 330000
  23. (if x #t)))
  24. (let ((x #f))
  25. (benchmark "executing else" 330000
  26. (if x #t))))
  27. (with-benchmark-prefix "if-<bool>-then-else"
  28. (benchmark "executing then" 330000
  29. (if #t #t #f))
  30. (benchmark "executing else" 330000
  31. (if #f #t #f)))
  32. (with-benchmark-prefix "if-<bool>-then"
  33. (benchmark "executing then" 330000
  34. (if #t #t))
  35. (benchmark "executing else" 330000
  36. (if #f #t)))