Fork me on GitHub
#cljs-dev
<
2017-06-21
>
rauh06:06:39

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?

rauh09:06:46

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

dnolen13:06:56

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

rauh17:06:10

Yeah, seems like a good idea.

rauh17:06:57

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).

dnolen18:06:51

not interested in that

dnolen18:06:07

we generally don't add protocols willy nilly

dnolen18:06:25

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

favila18:06:54

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)

rauh18:06:30

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