On Mon, Oct 10, 2011 at 10:53 AM, Ambrose Bonnaire-Sergeant < [email protected]> wrote:
> > > On Mon, Oct 10, 2011 at 10:28 PM, Rob Lally <[email protected]> wrote: > >> Would supporting other data structures make it slower when using vectors, >> or only when using non-vector seq's? >> > > If we use :seq pattern matching, it will use first/rest. This can be very > expensive. Vectors will take a performance hit. > > :vector matching uses subvec, which explains its advantages (speed) and > disadvantages (only supports vectors). > Well vector matching actually uses whatever form is most efficient for the "idea" of subvec. For primitive arrays, bytes it's done w/ offsets. > What I'm proposing is defaulting to :seq matching. It's very easy to > "switch on" :vector matching. > > Something like > > (match [v] > [[x & xs]] 1) <- :seq > > > (match [v] > [([x & xs] :vector)] 1) <- vector > > Ambrose > If we're going to go down this route, it's probably best to actually do what Clojure does with destructuring - use nth. So instead of using subvec, vector matching would also use offsets. David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
