mirror of https://github.com/status-im/reagent.git
Make constants const
This commit is contained in:
parent
f785362b46
commit
679136f5d5
|
@ -47,7 +47,7 @@
|
||||||
{:compiler {:optimizations :advanced
|
{:compiler {:optimizations :advanced
|
||||||
:elide-asserts true
|
:elide-asserts true
|
||||||
:pretty-print false
|
:pretty-print false
|
||||||
:pseudo-names true
|
;; :pseudo-names true
|
||||||
:output-dir "target/client"}}}}}]
|
:output-dir "target/client"}}}}}]
|
||||||
|
|
||||||
:prod-test [:test :prod]
|
:prod-test [:test :prod]
|
||||||
|
|
|
@ -202,9 +202,9 @@
|
||||||
(-handle-change [this sender oldval newval])
|
(-handle-change [this sender oldval newval])
|
||||||
(-update-watching [this derefed]))
|
(-update-watching [this derefed]))
|
||||||
|
|
||||||
(def clean 0)
|
(def ^:const clean 0)
|
||||||
(def maybe-dirty 1)
|
(def ^:const maybe-dirty 1)
|
||||||
(def dirty 2)
|
(def ^:const dirty 2)
|
||||||
|
|
||||||
(deftype Reaction [f ^:mutable state ^:mutable ^number dirtyness
|
(deftype Reaction [f ^:mutable state ^:mutable ^number dirtyness
|
||||||
^:mutable watching ^:mutable watches
|
^:mutable watching ^:mutable watches
|
||||||
|
@ -326,7 +326,7 @@
|
||||||
(set! watching nil)
|
(set! watching nil)
|
||||||
(set! state nil)
|
(set! state nil)
|
||||||
(set! dirtyness dirty)
|
(set! dirtyness dirty)
|
||||||
(when on-dispose
|
(when (some? on-dispose)
|
||||||
(on-dispose)))
|
(on-dispose)))
|
||||||
|
|
||||||
IEquiv
|
IEquiv
|
||||||
|
@ -419,3 +419,24 @@
|
||||||
(util/partial-ifn. callback-fn args nil)
|
(util/partial-ifn. callback-fn args nil)
|
||||||
false nil))
|
false nil))
|
||||||
|
|
||||||
|
(comment
|
||||||
|
(def perf-check 0)
|
||||||
|
(defn ratom-perf []
|
||||||
|
(dbg "ratom-perf")
|
||||||
|
(set! debug false)
|
||||||
|
(dotimes [_ 10]
|
||||||
|
(set! perf-check 0)
|
||||||
|
(let [nite 100000
|
||||||
|
a (atom 0)
|
||||||
|
mid (make-reaction (fn [] (inc @a)))
|
||||||
|
res (make-reaction (fn []
|
||||||
|
(set! perf-check (inc perf-check))
|
||||||
|
(inc @mid))
|
||||||
|
:auto-run true)]
|
||||||
|
@res
|
||||||
|
(time (dotimes [x nite]
|
||||||
|
(swap! a inc)))
|
||||||
|
(dispose! res)
|
||||||
|
(assert (= perf-check (inc nite))))))
|
||||||
|
(enable-console-print!)
|
||||||
|
(ratom-perf))
|
||||||
|
|
Loading…
Reference in New Issue