# Efficiently passing a set of constants to a function

**URL:** <https://discourse.julialang.org/t/efficiently-passing-a-set-of-constants-to-a-function/72248>\
**Category:** Performance\
**Tags:** functions, constants\
**Created:** [November 29, 2021, 4:37pm UTC](https://discourse.julialang.org/t/efficiently-passing-a-set-of-constants-to-a-function/72248 "2021-11-29T16:37:16Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![bgctw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bgctw/32/22050_2.png) [@bgctw](https://discourse.julialang.org/u/bgctw)\
**Post date:** [November 30, 2021, 6:48am UTC](https://discourse.julialang.org/t/efficiently-passing-a-set-of-constants-to-a-function/72248/11 "2021-11-30T06:48:29Z")

</div>

Thanks @DNF: I was wrong again. Julia is smart enough to not create an object here, but use the value directly:

```julia
f3(;cst=BigleafConstants()) = 2 * cst.g # note constructor call
@code_llvm f3() # return statement of a single value

```

where `BigleafConstants` struct is defined in the package, as in my example above.

---

_[View the full topic](https://discourse.julialang.org/t/efficiently-passing-a-set-of-constants-to-a-function/72248)._
