remove necessity to create array when deserializing
This commit is contained in:
parent
ab8cc0c859
commit
18f5699f3a
1 changed files with 24 additions and 12 deletions
|
|
@ -1868,18 +1868,30 @@
|
||||||
|
|
||||||
(if (= array-copy-method :loop)
|
(if (= array-copy-method :loop)
|
||||||
(let [a (gensym 'array)]
|
(let [a (gensym 'array)]
|
||||||
|
(if raw?
|
||||||
(concat
|
(concat
|
||||||
`(let [~a (~(coffitype->array-fn array-type) ~n)])
|
`(let [~a (~(coffitype->array-fn array-type) ~n)])
|
||||||
[(list `dotimes ['m n]
|
[(list `dotimes ['m n]
|
||||||
(list `aset a 'm (generate-deserialize array-type `(+ ~offset (* ~(size-of array-type) ~'m)) segment-source-form)))]
|
(list `aset a 'm (generate-deserialize array-type `(+ ~offset (* ~(size-of array-type) ~'m)) segment-source-form)))]
|
||||||
[(if raw? a `(vec ~a))]))
|
[(if raw? a `(vec ~a))])
|
||||||
|
(list `loop ['i 0 'v (list `transient [])]
|
||||||
|
(list `if (list `< 'i n)
|
||||||
|
(list `recur (list `unchecked-inc 'i) (list `conj! 'v (generate-deserialize array-type `(+ ~offset (* ~(size-of array-type) ~'i)) segment-source-form)))
|
||||||
|
(list `persistent! 'v)))
|
||||||
|
))
|
||||||
|
(if raw?
|
||||||
(let [a (gensym 'array)]
|
(let [a (gensym 'array)]
|
||||||
(concat
|
(concat
|
||||||
`(let [~a (~(coffitype->array-fn array-type) ~n)])
|
`(let [~a (~(coffitype->array-fn array-type) ~n)])
|
||||||
(map
|
(map
|
||||||
#(list `aset a % (generate-deserialize array-type (+ offset (* (size-of array-type) %)) segment-source-form))
|
#(list `aset a % (generate-deserialize array-type (+ offset (* (size-of array-type) %)) segment-source-form))
|
||||||
(range n))
|
(range n))
|
||||||
[(if raw? a `(vec ~a))])))))
|
[(if raw? a `(vec ~a))]))
|
||||||
|
(vec
|
||||||
|
(map
|
||||||
|
#(generate-deserialize array-type (+ offset (* (size-of array-type) %)) segment-source-form)
|
||||||
|
(range n)))
|
||||||
|
))))
|
||||||
|
|
||||||
(defn- typelist [typename fields]
|
(defn- typelist [typename fields]
|
||||||
(->>
|
(->>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue