On Fri, Jan 14, 2011 at 12:43 PM, David Nolen <[email protected]> wrote: > On Fri, Jan 14, 2011 at 12:07 PM, Sam Aaron <[email protected]> wrote: >> >> I was wondering what purpose the '4 or fewer args' restriction serves and >> therefore how you might retain the performance of this implementation with >> 1.3.0-alpha4 and beyond (assuming the restriction is here to stay). Would >> you have to break out into a number of smaller fns calculating the new x, y >> length and angle vals? > > Interfaces have to defined for every combination of primitive arguments - so > you get interface explosion, thus only 4.
The interfaces are needed only if the function is passed around as an object or dynamically rebound; if it's just called at a few fixed sites, those calls can be directly to a known class. Even then, couldn't the compiler generate the needed interfaces for a specific Clojure project on the fly along with the appropriate calls? Are they even needed at all? Can a passed-around function be invoked with unboxed primitive arguments? Later in the thread the OP is advised to wrap the primitive args in a deftype and pass an instance of that. Manual boxing, in essence. Won't that negate any performance improvement from using primitive args? -- 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
