Comment made by: gshayban
Hmm, I cannot reproduce your results.
I'm not sure whether you are testing with lein, on what platform, what jvm opts.
Can we test using this little harness instead directly against clojure.jar? I've attached a the harness and two runs of results (one w/ default heap, the other 3GB w/ G1GC)
I added a medium and small (range) too.
Anecdotally, I see doseq2 outperform in all cases except the small range. Using criterium shows a wider performance gap favoring doseq2.
I pasted the results side by side for easier viewing.
`
core/doseq doseq2
"Elapsed time: 1610.865146 msecs" "Elapsed time: 2315.427573 msecs"
"Elapsed time: 2561.079069 msecs" "Elapsed time: 2232.479584 msecs"
"Elapsed time: 2446.674237 msecs" "Elapsed time: 2234.556301 msecs"
"Elapsed time: 2443.129809 msecs" "Elapsed time: 2224.302855 msecs"
"Elapsed time: 2456.406103 msecs" "Elapsed time: 2210.383112 msecs"
;; med range, few bindings:
core/doseq doseq2
"Elapsed time: 28.383197 msecs" "Elapsed time: 31.676448 msecs"
"Elapsed time: 13.908323 msecs" "Elapsed time: 11.136818 msecs"
"Elapsed time: 18.956345 msecs" "Elapsed time: 11.137122 msecs"
"Elapsed time: 12.367901 msecs" "Elapsed time: 11.049121 msecs"
"Elapsed time: 13.449006 msecs" "Elapsed time: 11.141385 msecs"
;; small range, few bindings:
core/doseq doseq2
"Elapsed time: 0.386334 msecs" "Elapsed time: 0.372388 msecs"
"Elapsed time: 0.10521 msecs" "Elapsed time: 0.203328 msecs"
"Elapsed time: 0.083378 msecs" "Elapsed time: 0.179116 msecs"
"Elapsed time: 0.097281 msecs" "Elapsed time: 0.150563 msecs"
"Elapsed time: 0.095649 msecs" "Elapsed time: 0.167609 msecs"
;; small unchunked reducible, few bindings:
core/doseq doseq2
"Elapsed time: 2.351466 msecs" "Elapsed time: 2.749858 msecs"
"Elapsed time: 0.755616 msecs" "Elapsed time: 0.80578 msecs"
"Elapsed time: 0.664072 msecs" "Elapsed time: 0.661074 msecs"
"Elapsed time: 0.549186 msecs" "Elapsed time: 0.712239 msecs"
"Elapsed time: 0.551442 msecs" "Elapsed time: 0.518207 msecs"
core/doseq doseq2
"Elapsed time: 95.237101 msecs" "Elapsed time: 55.3067 msecs"
"Elapsed time: 41.030972 msecs" "Elapsed time: 30.817747 msecs"
"Elapsed time: 42.107288 msecs" "Elapsed time: 19.535747 msecs"
"Elapsed time: 41.088291 msecs" "Elapsed time: 4.099174 msecs"
"Elapsed time: 41.03616 msecs" "Elapsed time: 4.084832 msecs"
;; small chunked reducible, few bindings:
core/doseq doseq2
"Elapsed time: 31.793603 msecs" "Elapsed time: 40.082492 msecs"
"Elapsed time: 17.302798 msecs" "Elapsed time: 28.286991 msecs"
"Elapsed time: 17.212189 msecs" "Elapsed time: 14.897374 msecs"
"Elapsed time: 17.266534 msecs" "Elapsed time: 10.248547 msecs"
"Elapsed time: 17.227381 msecs" "Elapsed time: 10.022326 msecs"
;; more bindings:
core/doseq doseq2
"Elapsed time: 4.418727 msecs" "Elapsed time: 2.685198 msecs"
"Elapsed time: 2.421063 msecs" "Elapsed time: 2.384134 msecs"
"Elapsed time: 2.210393 msecs" "Elapsed time: 2.341696 msecs"
"Elapsed time: 2.450744 msecs" "Elapsed time: 2.339638 msecs"
"Elapsed time: 2.223919 msecs" "Elapsed time: 2.372942 msecs"
core/doseq doseq2
"Elapsed time: 28.869393 msecs" "Elapsed time: 2.997713 msecs"
"Elapsed time: 22.414038 msecs" "Elapsed time: 1.807955 msecs"
"Elapsed time: 21.913959 msecs" "Elapsed time: 1.870567 msecs"
"Elapsed time: 22.357315 msecs" "Elapsed time: 1.904163 msecs"
"Elapsed time: 21.138915 msecs" "Elapsed time: 1.694175 msecs"
`