Use into {} instead of apply hash-map

For huge maps, `apply` may cause OOM, because it will realize all
the elements of the arglist seq, and construct an Object[] to hold
them.
This commit is contained in:
Jerry Peng 2012-12-04 09:55:53 +08:00
parent df3c687acd
commit 800ae5f55a

View file

@ -193,7 +193,7 @@
id-list (apply list (coll-thaw! s)) id-list (apply list (coll-thaw! s))
id-vector (into [] (coll-thaw! s)) id-vector (into [] (coll-thaw! s))
id-set (into #{} (coll-thaw! s)) id-set (into #{} (coll-thaw! s))
id-map (apply hash-map (coll-thaw! s)) id-map (into {} (map vec (partition 2 (coll-thaw! s))))
id-coll (doall (coll-thaw! s)) id-coll (doall (coll-thaw! s))
id-queue (into (PersistentQueue/EMPTY) (coll-thaw! s)) id-queue (into (PersistentQueue/EMPTY) (coll-thaw! s))