> > Is really any call that isn't inlined that expensive?
>
> Yes, unfortunately. You saw the numbers. :)

If you mean the earlier thread about the Euler problem, I see that the
diagonal-sum-3 drastically outperforms diagonal-sum-2 by eliminating
HOFs and working with unchecked primitive ops. Eliminating the use of
HOFs mainly boils down to eliminating lazy-seqs, which bring both
memory and cpu overheads. But if all I have to pay for is a simple
function call (the function being referenced by a local), it may not
be much of a problem, especially on HotSpot, which will probably be
able to inline that code anyway. Of course, if those function calls
introduce boxing that otherwise wouldn't happen, that's a clear
performance issue. Am I wrong about this?

> Oh, and we'll finally be able to call functions with long and double
> primitive args and not just boxed numbers. :)

I think this is the one related to "Unless you're using 1.3 or
later..." since it allows for sub-functions that don't break the
primitive chain.

> I don't think the loop in diagonal-sum-3 (see other thread) is really
> "non-idiomatic", /for code that needs speed/.

But generally, it is even better when your clean-looking code performs
well -- and if the compiler can achieve that, it obsoletes any
specialized idioms for optimal code.

-- 
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

Reply via email to