# 10x slowdown when passing function as argument

**URL:** <https://discourse.julialang.org/t/10x-slowdown-when-passing-function-as-argument/40382>\
**Category:** Performance\
**Created:** [May 28, 2020, 11:39pm UTC](https://discourse.julialang.org/t/10x-slowdown-when-passing-function-as-argument/40382 "2020-05-28T23:39:59Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![jlchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlchan/32/10958_2.png) [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Post date:** [June 4, 2020, 6:04pm UTC](https://discourse.julialang.org/t/10x-slowdown-when-passing-function-as-argument/40382/17 "2020-06-04T18:04:41Z")

</div>

Seems like Julia’s function passing behavior is tricky to catch and profile - the specialization solution is the same as [this solution proposed in 2018](https://discourse.julialang.org/t/splatting-arguments-causes-30x-slow-down/16964), and folks in the thread noted that diagnosing this with `@code_warntype` can be tricky.

If these functions behave this way, what about for functions inherited by closure? I realized a lot of my code optimizations over the last week had to do with calling closure-inherited functions in a specific way to ensure specialization.

---

_[View the full topic](https://discourse.julialang.org/t/10x-slowdown-when-passing-function-as-argument/40382)._
