A PersistenVector that has <=32 elements and is {{seq}}'ed will return an IndexedSeq. Though IndexedSeq always fails the chunked-seq? check.
This means a:
(def xv (vec (range 32)))
(reduce + (map inc xv))
is about 4x slower than a map over a vector with 33 elements.
Options:
1. Return a ChunkedCons with the "rest" set to nil in PersistentVector.seq()
2. Implement IChunkedSeq for IndexedSeq:
`
(extend-type IndexedSeq
IChunkedSeq
(-chunked-first [x] x)
(-chunked-rest [x] ())
IChunkedNext
(-chunked-next [x] nil)
IChunk
(-drop-first [coll]
(if-some [n (-next coll)]
n
(throw (js/Error. "-drop-first of empty chunk")))))
`
I think option #2 is better since IndexedSeq is used quite a bunch throughout the code base, so the chunking will also kick in for many other code paths.