Guest User

Untitled

a guest
Jul 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. (defmacro benchmark*
  2. [functions lst]
  3. (println ";" (str-join "" (repeat 72 \=)))
  4. (pprint `~lst)
  5. (letfn [(make-fragment [f] `(let [m# ~lst] (~f m#)))]
  6. `(do
  7. ~@(loop [functions functions timers []]
  8. (if (seq functions)
  9. (recur (rest functions)
  10. (cons `(do
  11. (print ";" (quote ~(first functions)) ": ")
  12. (time ~(make-fragment (first functions)))
  13. nil)
  14. timers))
  15. timers))
  16. (println))))
  17.  
  18. (defmacro benchmark**
  19. [functions lst]
  20. (println ";" (str-join "" (repeat 72 \=)))
  21. (pprint `~lst)
  22. (letfn [(make-fragment [f] `(let [m# ~lst] (time (~f m#))))]
  23. `(do
  24. ~@(loop [functions functions timers []]
  25. (if (seq functions)
  26. (recur (rest functions)
  27. (cons `(do
  28. (print ";" (quote ~(first functions)) ": ")
  29. ~(make-fragment (first functions))
  30. nil)
  31. timers))
  32. timers))
  33. (println))))
Add Comment
Please, Sign In to add comment