> I'm must be missing something obvious for the [s1 s2] case of union: > > Is it only that you've measured (conj s1 s2) to be faster when s2 is > the smallest ?
Yes, that's it. "conj" iterates through the second argument, and since count is O(1) for sets, it makes sense to always iterate through the smaller argument. This makes a huge speed difference when you have one small set and one big set, as you can see in the timings I included. -Jason --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---