On Tue May 8 17:14 2012, kovas boguta wrote: > Will definitely be using this, thanks! One question: > > "Those IFn.LLL, DDD etc primitive-taking function interfaces can now > spring to life." > > Can someone unpack this? What are those things, why does this allow > them to exist, why do we need them, what can be built with them?
As of Clojure 1.3, you can use primitive hints to function definitions allowing the resulting function to be able to take raw doubles or longs instead of boxed numbers. This results in much better numeric performance. For more details see <http://dev.clojure.org/display/doc/Documentation+for+1.3+Numerics>. As I understand it, since the new reducers library relies on composing functions together, if those functions have this primitive support, it should be able to take advantage of it. For example, there are implementations of persistent vectors that keep unboxed primitives internally. Unfortunately, it is currently impossible to get values into or out of these structures without boxing. The new reducers library means that if the primitive-supporting vectors are reducible, they can invoke the reducer using primitives and store the result in yet another primitive-supporting vector, all without any boxing. This could also apply to raw primitive arrays. I hope that: 1. this helps, 2: I am not mistaken. Sincerely, Daniel
signature.asc
Description: Digital signature