# In place assignment of scalars vs vectors

**URL:** <https://discourse.julialang.org/t/in-place-assignment-of-scalars-vs-vectors/63542>\
**Category:** Performance\
**Created:** [June 25, 2021, 11:25am UTC](https://discourse.julialang.org/t/in-place-assignment-of-scalars-vs-vectors/63542 "2021-06-25T11:25:30Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [June 25, 2021, 2:40pm UTC](https://discourse.julialang.org/t/in-place-assignment-of-scalars-vs-vectors/63542/21 "2021-06-25T14:40:06Z")

</div>

Sure, that is what I meant, showing that `f` and `g` functions above produce the same `llvm` code. What I wanted to stress is that that kind of optimization (non-heap allocations) and simplifications (elimination) can happen also in a Fortran code, even if one declares the variables explicitly. It is no different from Julia or other languages in that regards, but since one _declares_ the variables, we can go trough life _thinking_ that every variable necessarily corresponds to an allocation in Fortran (I have thought so for many years, until being exposed to these things when I started to use Julia).

(I think you missed my complete example there 🙂 edit: sorry, I noticed that I ran `llvm f(1)` twice… but the result is the same for `g`)

[Previous page](https://discourse.julialang.org/t/in-place-assignment-of-scalars-vs-vectors/63542.md?page=1)
