mirror of
https://github.com/penpot/penpot.git
synced 2025-05-28 05:56:11 +02:00
✨ Change modifiers to records
This commit is contained in:
parent
600f9ef071
commit
c79d549f53
11 changed files with 436 additions and 268 deletions
|
@ -3,8 +3,10 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes.rect :as gsr]
|
||||
[app.common.perf :as perf]
|
||||
[app.common.types.modifiers :as ctm]
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.test.check.generators :as gen]))
|
||||
|
||||
|
@ -24,8 +26,40 @@
|
|||
:samples 20
|
||||
:name "optimized"))
|
||||
|
||||
(def modifiers
|
||||
(-> (ctm/empty)
|
||||
(ctm/move (gpt/point 100 200))
|
||||
(ctm/resize (gpt/point 100 200) (gpt/point 2.0 0.5))
|
||||
(ctm/move (gpt/point -100 -200))
|
||||
(ctm/resize (gpt/point 100 200) (gpt/point 2.0 0.5))
|
||||
(ctm/rotation (gpt/point 0 0) -100)
|
||||
(ctm/resize (gpt/point 100 200) (gpt/point 2.0 0.5))))
|
||||
|
||||
(defn bench-modifiers
|
||||
[]
|
||||
(perf/benchmark
|
||||
:f #(ctm/modifiers->transform modifiers)
|
||||
:max-iterations 50000
|
||||
:samples 20
|
||||
:name "current")
|
||||
|
||||
#_(perf/benchmark
|
||||
:f #(ctm/modifiers->transform-2 modifiers)
|
||||
:max-iterations 50000
|
||||
:samples 20
|
||||
:name "optimized"))
|
||||
|
||||
;; (ctm/modifiers->transform-2 modifiers)
|
||||
|
||||
(defn ^:dev/after-load after-load
|
||||
[]
|
||||
#_(bench-modifiers))
|
||||
|
||||
(defn main
|
||||
[& [name]]
|
||||
(case name
|
||||
"points" (bench-points)
|
||||
(println "available: points")))
|
||||
"modifiers" (bench-modifiers)
|
||||
(println "available: points"))
|
||||
#_(.exit js/process 0))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue