Add todos for optimization

This commit is contained in:
Joshua Suskalo 2021-10-10 11:40:40 -05:00
parent 9efee59dd6
commit c26c8a40c8
2 changed files with 7 additions and 0 deletions

View file

@ -231,6 +231,7 @@
(let [args (concat required-args types)] (let [args (concat required-args types)]
(make-downcall symbol args ret))))) (make-downcall symbol args ret)))))
;; TODO(Joshua): Optimize this to not serialize things if possible
(defn make-serde-wrapper (defn make-serde-wrapper
"Constructs a wrapper function for the `downcall` which serializes the arguments "Constructs a wrapper function for the `downcall` which serializes the arguments
and deserializes the return value." and deserializes the return value."

View file

@ -230,6 +230,7 @@
Returns nil for any type which does not have a primitive representation." Returns nil for any type which does not have a primitive representation."
type-dispatch) type-dispatch)
;; TODO(Joshua): For performance, turn this into a bunch of specific defmethods
(defmethod primitive-type :default (defmethod primitive-type :default
[type] [type]
(primitive-types type)) (primitive-types type))
@ -259,6 +260,7 @@
Otherwise, it should return a [[GroupLayout]] for the given type." Otherwise, it should return a [[GroupLayout]] for the given type."
type-dispatch) type-dispatch)
;; TODO(Joshua): For performance, turn this into a bunch of specific defmethods
(defmethod c-layout :default (defmethod c-layout :default
[type] [type]
(c-prim-layout (or (primitive-type type) type))) (c-prim-layout (or (primitive-type type) type)))
@ -319,6 +321,7 @@
::float float ::float float
::double double}) ::double double})
;; TODO(Joshua): For performance, turn this into a bunch of specific defmethods
(defmethod serialize* :default (defmethod serialize* :default
[obj type _scope] [obj type _scope]
(if-let [prim (primitive-type type)] (if-let [prim (primitive-type type)]
@ -358,6 +361,7 @@
[obj type segment scope] [obj type segment scope]
(type-dispatch type))) (type-dispatch type)))
;; TODO(Joshua): For performance, turn this into a bunch of specific defmethods
(defmethod serialize-into :default (defmethod serialize-into :default
[obj type segment scope] [obj type segment scope]
(if-some [prim-layout (primitive-type type)] (if-some [prim-layout (primitive-type type)]
@ -436,6 +440,7 @@
[segment type] [segment type]
(type-dispatch type))) (type-dispatch type)))
;; TODO(Joshua): For performance, turn this into a bunch of specific defmethods
(defmethod deserialize-from :default (defmethod deserialize-from :default
[segment type] [segment type]
(if-some [prim (primitive-type type)] (if-some [prim (primitive-type type)]
@ -495,6 +500,7 @@
[obj type] [obj type]
(type-dispatch type))) (type-dispatch type)))
;; TODO(Joshua): For performance, turn this into a bunch of specific defmethods
(defmethod deserialize* :default (defmethod deserialize* :default
[obj type] [obj type]
(if (primitive-type type) (if (primitive-type type)