On 7 September 2015 at 13:59, James Reeves <ja...@booleanknot.com> wrote:
> On 6 September 2015 at 15:38, Timothy Baldridge <tbaldri...@gmail.com> > wrote: >> >> As far as performance goes, this is normally the sort of thing that gets >> baked into an app at a pretty low level, that's why I suggest it should be >> as fast as possible. If you're going to be processing millions of these >> things during the life of an app, and transforming them from one format to >> another, a little tweaking here and there may save you some pain in the >> end. >> > > I was curious as to whether records really were faster than a vector > lookup. It turns out that vectors are faster: > I realised after I sent my email that you were earlier referring to creation rather than lookup. In such a case, it *is* slightly quicker to use a record: => (let [x 1 y 2] (quick-bench (->Foo x y))) Execution time mean : 9.578002 ns => (let [x 1 y 2] (quick-bench [x y])) Execution time mean : 12.213409 ns So in terms of performance, it matters whether you're primarily reading or primarily writing. Vectors are faster for lookups, records are faster for creation. That said, if performance is important enough that even a couple of nanoseconds per iteration matter, then perhaps an array should be used instead. - James -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.