# The best way to pass intermediate value to auxiliary functions

**URL:** https://discourse.julialang.org/t/the-best-way-to-pass-intermediate-value-to-auxiliary-functions/80254
**Category:** Performance
**Tags:** function
**Created:** [April 29, 2022, 12:50pm UTC](https://discourse.julialang.org/t/the-best-way-to-pass-intermediate-value-to-auxiliary-functions/80254 "2022-04-29T12:50:54Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)
#### Post date: [April 29, 2022, 2:10pm UTC](https://discourse.julialang.org/t/the-best-way-to-pass-intermediate-value-to-auxiliary-functions/80254/2 "2022-04-29T14:10:55Z")

</div>

Create a `struct`, you comment

> But unpacking a struct takes time.

what is your empirical base for it? If the `struct` is immutable, then unpacking is basically aliasing a address in the stack and incurs in no runtime penalty (maybe slightly more compilation time). If you struct is mutable each unpacked field is just one pointer de-reference to a value probably already in L1 cache; is your auxiliary function so lightweight that this de-reference is a considerable overhead?

---

_[View the full topic](https://discourse.julialang.org/t/the-best-way-to-pass-intermediate-value-to-auxiliary-functions/80254)._
