Some cleanup

This commit is contained in:
Dan Holmsand 2015-09-10 21:16:59 +02:00
parent 0b77d9af31
commit f785362b46
3 changed files with 11 additions and 15 deletions

View File

@ -47,7 +47,7 @@
{:compiler {:optimizations :advanced
:elide-asserts true
:pretty-print false
;; :pseudo-names true
:pseudo-names true
:output-dir "target/client"}}}}}]
:prod-test [:test :prod]

View File

@ -295,34 +295,29 @@
IRunnable
(run [this]
(set! norun? true)
(let [oldstate state
res (capture-derefed f this)
derefed (captured this)]
(when (not= derefed watching)
(-update-watching this derefed))
(set! norun? false)
(set! dirtyness clean)
(set! state res)
(-notify-watches this oldstate state)
(-notify-watches this oldstate (set! state res))
res))
IDeref
(-deref [this]
(-check-clean this)
(if (or (some? auto-run) (some? *ratom-context*))
(if (and (nil? auto-run) (nil? *ratom-context*))
(when-not (== dirtyness clean)
(let [oldstate state
newstate (f)]
(when-not (identical? oldstate newstate)
(-notify-watches this oldstate (set! state newstate)))))
(do
(notify-deref-watcher! this)
(if-not (== dirtyness clean)
(run this)
state))
(do
(when-not (== dirtyness clean)
(let [oldstate state]
(set! state (f))
(when-not (identical? oldstate state)
(-notify-watches this oldstate state))))
state)))
(run this))))
state)
IDisposable
(dispose! [this]

View File

@ -16,6 +16,7 @@
(def perf-check 0)
(defn ratom-perf []
(dbg "ratom-perf")
(set! rv/debug false)
(set! perf-check 0)
(let [nite 100000
a (rv/atom 0)