On Mon, Jan 27, 2014 at 12:48 PM, Mike Haney <[email protected]> wrote:

> I was initially surprised by the implementation in your tutorial using
> multimethods instead of protocols, especially since you are only
> dispatching on a single function.  But as I thought about it more, I
> realized this could be a perfect place for multiple dispatch, i.e. swapping
> components based on multiple pieces of application state.  Powerful stuff!
>

The problem with protocols is that they are type directed - I think for
most user interfaces you want something data directed.

One question - I've tended to shy away from multimethods because of the
> performance hit, but this is a compelling case for their usage.  Just how
> big of a performance hit are we talking about, compared to protocols or
> regular function invocation?


Multimethods are probably 4X-5X slower in ClojureScript then they should
be. I'll probably be looking into optimizing them in the near future.
However using them with Om is fine since they aren't really part of the
inner loop - all the time is going to be spent in React, not your
ClojureScript.

David

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to