# Help making function faster

**URL:** <https://discourse.julialang.org/t/help-making-function-faster/3793>\
**Category:** General Usage\
**Created:** [May 18, 2017, 9:18pm UTC](https://discourse.julialang.org/t/help-making-function-faster/3793 "2017-05-18T21:18:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ksmcreynolds](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ksmcreynolds/32/860_2.png) [@ksmcreynolds](https://discourse.julialang.org/u/ksmcreynolds)\
**Post date:** [May 19, 2017, 2:18pm UTC](https://discourse.julialang.org/t/help-making-function-faster/3793/2 "2017-05-19T14:18:29Z")

</div>

The issue appears to be due to the behavior of threads in 0.6. I’ve had a similar problem (see [Multithreading performance regressions in 0.6?](https://discourse.julialang.org/t/multithreading-performance-regressions-in-0-6/3748)). You can solve this by wrapping the threaded loop in its own function and calling that. Doing that I get `dx!` to be about twice as fast as `dx`.

Also you should run each function once before timing it or you will include the compilation time that only occurs on the first run.

---

_[View the full topic](https://discourse.julialang.org/t/help-making-function-faster/3793)._
