Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. (defn using-xform--improved [chunks]
  2. (transduce (comp (halt-when error?)
  3. cat
  4. (x/by-key :a x/count))
  5. conj
  6. {}
  7. chunks))
  8.  
  9. (using-xform--improved chunks)
  10. => {0 3330, 1 3330, 2 3330} ;; Still works
  11.  
  12. (using-xform--improved mini-chunks-with-error)
  13. => {:error "Something terrible has happened!"} ;; Better!
  14.  
  15. (criterium/bench (using-xform--improved chunks))
  16. "
  17. Evaluation count : 156300 in 60 samples of 2605 calls.
  18. Execution time mean : 405.974099 µs
  19. Execution time std-deviation : 21.578325 µs
  20. Execution time lower quantile : 377.589901 µs ( 2.5%)
  21. Execution time upper quantile : 448.218002 µs (97.5%)
  22. Overhead used : 1.481300 ns
  23.  
  24. Found 1 outliers in 60 samples (1.6667 %)
  25. low-severe 1 (1.6667 %)
  26. Variance from outliers : 38.5251 % Variance is moderately inflated by outliers
  27. "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement