Good to know your measurements are more encouraging. As to the slowdown:
I do realize that checking seq type every step of the day is problematic, but I don't know that we can simply not do it. Sequences routinely turn out to be part chunked, part not (e.g. cons a single element onto a vector seq, concat a non-chunked seq with a chunked-seq); Clojure switches processing mode midway in such cases and I thought it would be good to do so in ClojureScript as well. In fact in the chunked case we simply must do it, because the chunked logic makes no sense for non-chunked seqs; but it's clearly no problem there, given the speedup.
I thought that maybe the check could be performed, say, every 8 steps or so (that is, if we start off in the non-chunked case), hoping that this would give most of the benefit for mostly chunked seqs, while only introducing a minor hit for mostly non-chunked seqs. I've played with two patches along these lines with not quite satisfactory results; I was certainly planning to give it another go – do you think this sounds worthwhile?
Of course we could start with a version of the patch which does the straightforward thing (permanently switching to current behaviour at the first sign of non-chunkedness, but still boosting seqs which start off chunked) and then try to figure out if switching midway is possible without too much of a perf hit.
On a side note, I need to upgrade my benchmarking setup, I think it may have been too long since I've upgraded V8... This could explain the larger slowdown that I am seeing.
Commit message:
CLJS-367: chunked seq support in for, comprehension benchmarks Copy & paste from Clojure with small tweaks (-nth instead of .nth on chunks, ClojureScript-specific type hints). Also fixes a minor bug around argument format verification in for.for performance on the attached benchmark is dramatically improved by the patch. doseq is unchanged for now, because a similar copy & paste approach makes it slower by more than a factor of 2. I'll try and investigate the reasons for that, but in the meantime, the unchunked doseq is still faster than even the chunked for (doseq benchmark takes around 4x as much time, but that's over 10x as many iterations) and for can already benefit from the present patch.
CLJS-367: chunked seq support in for, comprehension benchmarks Copy & paste from Clojure with small tweaks (-nth instead of .nth on chunks, ClojureScript-specific type hints). Also fixes a minor bug around argument format verification in for.