It's been a long time since I looked at this, but as of a few years ago,
the biggest noticeable performance detriment of comp or partial was likely
to come if you pass enough args to hit a "& args" overload, which requires
creating a fresh object array at each call, when the underlying function
being called has a non-"& args" arity.

On one application I worked on, we preferred defining #(anonymous ...)
functions to some uses of higher order functions to avoid excessive
garbage-creation in some hot spots.

This assumes you don't need primitive type-hint-level optimization.

I wouldn't recommend sacrificing any clarity unless you've profiled and
found a real issue.

definition of partial:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L2614

definition of comp:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L2557


On Sun, Oct 20, 2019, 3:25 PM david hoyt <davidpaulh...@gmail.com> wrote:

> Is there a performance benefit (or detriment) to creating partial
> functions? Other than the potential reduction of complexity, is there a
> difference between using partial & comp and defining new functions?
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/146f2a73-9887-4eba-89c6-815eed6841b1%40googlegroups.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAKK7-VLE_TPdjBuf6g8n0hVLaiMeibS63wJ8UqGDKD1qGZ4T2A%40mail.gmail.com.

Reply via email to