Fork me on GitHub

Possibly silly question: Is there a reason IComparable for Keyword, Symbol etc is not implemented directly during at the deftype of those types but instead with extend-protocol IComparable? If it were implemented right at the deftype it would be properly added to the bit mask for the fast-path-protocols and offer a (possibly) faster satisfies and thus faster compare of those types, right?


Hmm, actually seems faster if NOT added to the fast-path mask. Ie, how it is now.


yeah the fast path mask thing may be obsolete - something worth testing is just removing that stuff and testing the major browsers


Yeah, seems like a good idea.


So I just checked the types that were passed into apply and the vast majority (for my app) are IndexedSeq & Vectors. Which makes sense. An idea: We could add a protocol to core that adds all the contents of a collection to an array. Like IIntoArray with (-into-array [arr]). That could be used in various places, not just apply. (Like sort).


not interested in that


we generally don't add protocols willy nilly


really only for protocols with matching interfaces in Clojure with very few exceptions


maybe something akin to .applyTo (i.e. private method, not protocol) if speed benefits are worth it? (I'm skeptical that it makes much diff)


Yeah, I agree it probably doesn't matter too much.