Skip to content

Commit 723e1fc

Browse files
committed
CLJS-2100: to-array calls seq too often
optimize to-array-2d as well
1 parent a08587f commit 723e1fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3495,8 +3495,8 @@ reduces them without incurring seq initialization"
34953495
"Naive impl of to-array as a start."
34963496
[s]
34973497
(let [ary (array)]
3498-
(loop [s s]
3499-
(if (seq s)
3498+
(loop [s (seq s)]
3499+
(if-not (nil? s)
35003500
(do (. ary push (first s))
35013501
(recur (next s)))
35023502
ary))))
@@ -3507,7 +3507,7 @@ reduces them without incurring seq initialization"
35073507
[coll]
35083508
(let [ret (make-array (count coll))]
35093509
(loop [i 0 xs (seq coll)]
3510-
(when xs
3510+
(when-not (nil? xs)
35113511
(aset ret i (to-array (first xs)))
35123512
(recur (inc i) (next xs))))
35133513
ret))

0 commit comments

Comments
 (0)