Hi, I've reworked my tuple type into an ArrayVector type. Instead of using #[] reader macro, ArrayVector replaces PersistentVector for small vectors and falls back to PersistentVector as it grows. Fast destructuring is achieved with ^ArrayVector hint.
See http://dev.clojure.org/jira/browse/CLJS-453 for patch and more info. JW On Tuesday, January 1, 2013 9:01:42 AM UTC+1, Jozef Wagner wrote: > > Yes I have patched destructuring, http://goo.gl/Xc23p , and I use #[] for > both tuple creation and destructuring, see example in my earlier message. > > Type hinting could be a nicer solution, I've never thought of it. Will try. > > JW > > On Tuesday, January 1, 2013 1:40:50 AM UTC+1, Brandon Bloom wrote: >> >> > Significant performance gain is achieved when destructuring by skipping >> nth and directly calling type fields instead. >> >> Have you also patched the destructuring mechanism? >> >> > Concrete vector implementation is not known when destructuring, so I'm >> left with a custom reader literal. >> >> How does the reader literal affect the site of destructuring? Are you >> also using the #[] literal for the destructure target? ie: >> >> (let [#[x y] #[1 2]] ...) >> >> If so, then wouldn't to make more sense to rely on type hints? >> >> (let [[x y] ^Tuple2 (tuple 1 2)] ...) >> >> I guess, potentially, you could rely on the explicit vector type for >> small literals: >> >> (let [[x y] ^Vec2 [1 2]] ...) >> >> But that seems like a bad idea.... >> > -- 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