@@ -4124,16 +4124,26 @@ reduces them without incurring seq initialization"
41244124
41254125(set! *unchecked-if* false )
41264126
4127+ (declare ObjMap )
4128+
41274129; ; CLJS-3200: used by destructure macro for maps to reduce amount of repeated code
41284130; ; placed here because it needs apply and hash-map (only declared at this point)
41294131(defn --destructure-map [gmap]
4130- (if (implements? ISeq gmap)
4131- (if (next gmap)
4132- (.createAsIfByAssoc PersistentArrayMap (to-array gmap))
4133- (if (seq gmap)
4134- (first gmap)
4135- (.-EMPTY PersistentArrayMap)))
4136- gmap))
4132+ (if ^boolean LITE_MODE
4133+ (if (implements? ISeq gmap)
4134+ (if (next gmap)
4135+ (.createAsIfByAssoc ObjMap (to-array gmap))
4136+ (if (seq gmap)
4137+ (first gmap)
4138+ (.-EMPTY ObjMap)))
4139+ gmap)
4140+ (if (implements? ISeq gmap)
4141+ (if (next gmap)
4142+ (.createAsIfByAssoc PersistentArrayMap (to-array gmap))
4143+ (if (seq gmap)
4144+ (first gmap)
4145+ (.-EMPTY PersistentArrayMap)))
4146+ gmap)))
41374147
41384148(defn vary-meta
41394149 " Returns an object of the same type and value as obj, with
@@ -7126,7 +7136,7 @@ reduces them without incurring seq initialization"
71267136 (fn [init]
71277137 ; ; check trailing element
71287138 (let [len (alength init)
7129- has-trailing? (== 1 (bit-and len 1 ))]
7139+ has-trailing? (== 1 (bit-and len 1 ))]
71307140 (if-not (or has-trailing? (pam-dupes? init))
71317141 (PersistentArrayMap. nil (/ len 2 ) init nil )
71327142 (.createAsIfByAssocComplexPath PersistentArrayMap init has-trailing?)))))
@@ -9039,9 +9049,13 @@ reduces them without incurring seq initialization"
90399049 " Builds a map from a seq as described in
90409050 https://clojure.org/reference/special_forms#keyword-arguments"
90419051 [s]
9042- (if (next s)
9043- (.createAsIfByAssoc PersistentArrayMap (to-array s))
9044- (if (seq s) (first s) (.-EMPTY PersistentArrayMap))))
9052+ (if ^boolean LITE_MODE
9053+ (if (next s)
9054+ (.createAsIfByAssoc ObjMap (to-array s))
9055+ (if (seq s) (first s) (.-EMPTY ObjMap)))
9056+ (if (next s)
9057+ (.createAsIfByAssoc PersistentArrayMap (to-array s))
9058+ (if (seq s) (first s) (.-EMPTY PersistentArrayMap)))))
90459059
90469060(defn sorted-map
90479061 " keyval => key val
@@ -12731,6 +12745,21 @@ reduces them without incurring seq initialization"
1273112745 (recur (nnext kvs)))
1273212746 (.fromObject ObjMap ks obj)))))
1273312747
12748+ (set! (. ObjMap -createAsIfByAssoc)
12749+ (fn [init]
12750+ ; ; check trailing element
12751+ (let [len (alength init)
12752+ has-trailing? (== 1 (bit-and len 1 ))
12753+ init (if has-trailing?
12754+ (pam-grow-seed-array init
12755+ (into {} (aget init (dec len))))
12756+ init)
12757+ len (alength init)]
12758+ (loop [i 0 ret {}]
12759+ (if (< i len)
12760+ (recur (+ i 2 ) (assoc ret (aget init i) (aget init (inc i))))
12761+ ret)))))
12762+
1273412763(defn- scan-array-equiv [incr k array]
1273512764 (let [len (alength array)]
1273612765 (loop [i 0 ]
0 commit comments