On 11 jan 2014, at 18:51, Peter Taoussanis <ptaoussa...@gmail.com> wrote:
> 
> Am looking at this from a performance point of view. You're marking 
> components as dirty when there's any change in an atom being deref'ed by the 
> component, right?
> 
> But I'm guessing it's quite common for a component to be dealing with only a 
> small subset of the data within a larger state atom. (This is what Om's 
> cursors are addressing, it seems). In that case (please correct me if I'm 
> wrong) - the number of needless rerenders will grow with the number of 
> component-irrelevant bits of information in each atom.
> 
> One simple way of addressing that is to use more, smaller atoms - or to use 
> "views" on atoms (as Reflex does). For example instead of marking a component 
> as dirty when @my-atom changes, we could mark it as dirty only when 
> `(:relevant-submap @my-atom)` changes.

Right, you could do that (there is a "reaction" macro in ratom.clj that is 
exactly a view on atoms).

But it would probably be better to just pass (:relevant-submap @my-atom) to a 
sub-component. The subcomponent will only be re-rendered when its arguments 
(i.e the params map and possible children) changes. 

Also, React is fast enough that a few re-renderings won't even be noticeable 
most of the time. Unless React actually has to change the DOM the cost is very 
low.

/dan

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to