Tassilo Horn <t...@gnu.org> writes: > But on the other hand, many of my protocols aren't open but merely an > implementation detail, and they are extended upon only a few java > classes (many only 2). For those it seems to be more efficient to use > a plain function explicitly dispatching on type using `instance?'...
I just did that now with 3 of my most frequently used protocols all being extended to only 2 java types each, and it brought me a performance boost of ~15% and a bit less code. 15% doesn't sound that much, but when considering that large portions of the overall time is spend in the actual function logic and not in the type dispatch, it's astonishingly good. Another good thing here is the fact that I know that in ~95% of all cases the function is called on an object of type A rather than the other possibility B, so writing (condp instance? x A (do-A-stuff-with x) B (do-B-stuff-with x)) rather than first testing for B and then A makes a difference. Bye, Tassilo -- 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