This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-21
Channels
- # admin-announcements (3)
- # beginners (15)
- # boot (96)
- # cider (5)
- # cljsjs (2)
- # cljsrn (3)
- # clojure (22)
- # clojure-austin (2)
- # clojure-russia (16)
- # clojured (2)
- # clojurescript (65)
- # css (4)
- # cursive (89)
- # datomic (7)
- # emacs (89)
- # events (1)
- # hoplon (126)
- # leiningen (2)
- # off-topic (2)
- # om (268)
- # onyx (19)
- # parinfer (42)
- # re-frame (5)
- # reagent (30)
- # yada (8)
added some instrumentation, i see like 12 calls to do-render, each of which takes between 0.1ms and 1.86ms, which doesn't account for the 110ms-140ms that the forceUpdate call takes; will continue to dig
aha! found http://jasonrudolph.com/resources/201209-cljs-performance-profiling.png , which suggests adding console.profile() / console.profileEnd() calls
which gives me output like https://www.evernote.com/shard/s11/sh/bf71e155-af2b-47a3-b1cf-aced40ca39fd/ccc14883cdd4f1d2 , which suggests that one of my math-heavy functions is taking a nontrivial amount of time; i'll try memoizing it, it's pure
I might ping you offline about profiling sometime. Havent done that yet. Happy to hear memorizing helped a bit
this was the entire code change necessary for the speedup: http://pastebin.com/Qhx9LxL3
hit me up re: profiling any time, if i get good at this (have done a lot of profiling in python, but none in JS) i'll eventually do a blog post (or more likely just accumulate a collection of other good blog posts other people have already written)
Could someone please explain a simple point: if you specific an atom in a let
block, why is that different to an external atom? Sorry if that’s badly explained… here’s a code example from the reagent docs - https://gist.github.com/heeton/465ca70602e39f6b3a6d
If you define the atom outside of a component, all is good. If you want to define it inside a let
block, it will display but not update.
@heeton read this: https://github.com/reagent-project/reagent-cookbook/blob/master/basics/component-level-state/README.md
@gadfly361: ahhhhh, thank you!
Np! Then after, be sure to read the best docs ever by mike thompson, which also covers this topic: https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-2--a-function-returning-a-function
@gadfly361: As I understand it then: if the atom is defined in the let
block, it’s being redefined upon every single rendering of the component, and so can never be updated?
@gadfly361: Well spin my nipple nuts and send me to Alaska. It works!