mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
⚡ Make matrix use native doubles.
Increases 300x the performance of multiply on the JVM platform.
This commit is contained in:
parent
e5885e83eb
commit
8479a6581d
2 changed files with 15 additions and 2 deletions
|
@ -14,7 +14,12 @@
|
||||||
|
|
||||||
;; --- Matrix Impl
|
;; --- 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
|
Object
|
||||||
(toString [_]
|
(toString [_]
|
||||||
(str "matrix(" a "," b "," c "," d "," e "," f ")")))
|
(str "matrix(" a "," b "," c "," d "," e "," f ")")))
|
||||||
|
|
|
@ -72,7 +72,15 @@
|
||||||
(fn [v] (into {} v))))
|
(fn [v] (into {} v))))
|
||||||
|
|
||||||
(def matrix-read-handler
|
(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
|
;; --- ORDERED SET
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue