You're right. I didn't check it enough. I did check out the source (and btw, was very impressed with the result) but it looks like the function call ended up doing nothing. I just put in a side effect and I got the following results:
"[a :one], (multi-test), 1000000 runs, 2933 msecs" "[a :one], (fn-test), 1000000 runs, 500 msecs" Much more reasonable and I'm willing to pay for that for using multimethods. I removed the jsperf and updated the repo. Sorry for spreading FUD. Cheers On Monday, April 27, 2015 at 10:07:07 AM UTC-4, David Nolen wrote: > > A quick glance at your benchmarking setup, it's not clear that you are > benchmarking what you think you are benchmarking, and jsperf is not a > suitable benchmarking harness (irrespective of it's popularity). > Benchmarking is hard, benchmarking JavaScript is harder, and benchmarking > JavaScript that went through Google Closure is even more challenging than > that. It's for this reason we have our own simple benchmarking suite that > we run in the project repo itself against 4 JavaScript engines (V8, > JavaScriptCore, SpiderMonkey, Nashorn) at the command line. > > For people that want to see accurate benchmarking information posted to > some public location, this is a great place to get involved contributing to > ClojureScript without needing to dig into the compiler. > > My earlier points about the general performance expectations of > multimethods in ClojureScript still stands :) > > David > > On Mon, Apr 27, 2015 at 9:44 AM, Andy- <andre...@gmail.com <javascript:>> > wrote: > >> Looks like they're pretty slow compared to a simple case: >> >> http://jsperf.com/cljs-multimethods >> >> https://github.com/rauhs/cljs-perf >> >> >> On Saturday, April 25, 2015 at 10:33:18 AM UTC-4, Timur wrote: >>> >>> Hi everyone, >>> >>> There are situations where I want to dispatch functions using based on >>> their certain properties. I can also use case statements instead but it >>> looks more coupled and more change is required if I want to add new types. >>> >>> What I want to ask is if I need to avoid using multi-methods for >>> performance reasons? I read somewhere that they are not really fast but the >>> posts were old and the performance might have been improved in between. >>> Should I favor case and cond branches instead of defmulti when I need >>> performance? >>> >>> Thanks for your help!!! >>> >>> Regards. >>> >>> Timur >>> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> 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+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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/d/optout.