0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-16 00:41:25 -05:00

Make matrix use native doubles.

Increases 300x the performance of multiply on the JVM platform.
This commit is contained in:
Andrey Antukh 2021-12-28 23:21:56 +01:00 committed by Alonso Torres
parent e5885e83eb
commit 8479a6581d
2 changed files with 15 additions and 2 deletions

View file

@ -14,7 +14,12 @@
;; --- Matrix Impl
(defrecord Matrix [a b c d e f]
(defrecord Matrix [^double a
^double b
^double c
^double d
^double e
^double f]
Object
(toString [_]
(str "matrix(" a "," b "," c "," d "," e "," f ")")))

View file

@ -72,7 +72,15 @@
(fn [v] (into {} v))))
(def matrix-read-handler
(t/read-handler gmt/map->Matrix))
(t/read-handler (fn [data]
#?(:cljs (gmt/map->Matrix data)
:clj (let [{:keys [a b c d e f]} data]
(gmt/matrix (double a)
(double b)
(double c)
(double d)
(double e)
(double f)))))))
;; --- ORDERED SET