Skip to content

Commit 5873009

Browse files
committed
avoid lazyseq stuff in HashMap impl
1 parent 4f4842a commit 5873009

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12552,9 +12552,20 @@ reduces them without incurring seq initialization"
1255212552
ISeqable
1255312553
(-seq [coll]
1255412554
(when (pos? count)
12555-
(let [hashes (.sort (js-keys hashobj))]
12556-
(mapcat #(map (fn [[k v]] (MapEntry. k v nil)) (partition 2 (unchecked-get hashobj %)))
12557-
hashes))))
12555+
(let [hashes (.sort (js-keys hashobj))
12556+
cnt (alength hashes)
12557+
arr (array)]
12558+
(loop [i 0]
12559+
(if (< i cnt)
12560+
(let [bckt (unchecked-get hashobj (aget hashes i))
12561+
len (alength bkt)]
12562+
(loop [j 0]
12563+
(when (< j len)
12564+
(do
12565+
(.push arr (MapEntry. (aget bkt j) (aget bkt (inc j)) nil))
12566+
(recur (+ j 2)))))
12567+
(recur (inc i)))
12568+
(prim-seq arr))))))
1255812569

1255912570
ICounted
1256012571
(-count [coll] count)

0 commit comments

Comments
 (0)