   (-chunked-first [coll]
     (array-chunk node off))
   (-chunked-rest [coll]
-    (let [l (alength node)
-          s (when (< (+ i l) (-count vec))
-              (chunked-seq vec (+ i l) 0))]
-      (if (nil? s)
-        ()
-        s)))
+    (let [end (+ i (alength node))]
+      (if (< end (-count vec))
+        (chunked-seq vec (unchecked-array-for vec end) end 0)
+        ())))
 
   IChunkedNext
   (-chunked-next [coll]
-    (let [l (alength node)
-          s (when (< (+ i l) (-count vec))
-              (chunked-seq vec (+ i l) 0))]
-      (if (nil? s)
-        nil
-        s)))
+    (let [end (+ i (alength node))]
+      (when (< end (-count vec))
+        (chunked-seq vec (unchecked-array-for vec end) end 0))))
+
   IHash
   (-hash [coll] (caching-hash coll hash-coll __hash))
 

(defn- vector-index-out-of-bounds [i cnt]
  (throw (js/Error. (str "No item " i " in vector of length " cnt))))

(defn- array-for [pv i]
  (if (and (<= 0 i) (< i (.-cnt pv)))
    (if (>= i (tail-off pv))
      (.-tail pv)
      (loop [node (.-root pv)
             level (.-shift pv)]
        (if (pos? level)
          (recur (pv-aget node (bit-and (bit-shift-right-zero-fill i level) 0x01f))
                 (- level 5))
          (.-arr node))))
    (vector-index-out-of-bounds i (.-cnt pv))))

(defn- do-assoc [pv level node i val]

     (== 1 cnt) (-with-meta cljs.core.PersistentVector.EMPTY meta)
     (< 1 (- cnt (tail-off coll)))
      (PersistentVector. meta (dec cnt) shift root (.slice tail 0 -1) nil)
      :else (let [new-tail (unchecked-array-for coll (- cnt 2))
                  nr (pop-tail coll shift root)
                  new-root (if (nil? nr) cljs.core.PersistentVector.EMPTY_NODE nr)
                  cnt-1 (dec cnt)]
