# Why is this numerical scheme so much faster when using \`collect()\` than a for loop?

**URL:** <https://discourse.julialang.org/t/why-is-this-numerical-scheme-so-much-faster-when-using-collect-than-a-for-loop/77949>\
**Category:** Performance\
**Created:** [March 16, 2022, 5:57am UTC](https://discourse.julialang.org/t/why-is-this-numerical-scheme-so-much-faster-when-using-collect-than-a-for-loop/77949 "2022-03-16T05:57:30Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [March 17, 2022, 2:34am UTC](https://discourse.julialang.org/t/why-is-this-numerical-scheme-so-much-faster-when-using-collect-than-a-for-loop/77949/5 "2022-03-17T02:34:38Z")

</div>

I was able to create an example that (I think) is benchmarked correctly. I created a new thread here: [Why is `collect()` faster than a for loop in this numerical scheme? (corrected!)](https://discourse.julialang.org/t/why-is-collect-faster-than-a-for-loop-in-this-numerical-scheme-corrected/78003)

I’d be very grateful if you could take a look.

---

_[View the full topic](https://discourse.julialang.org/t/why-is-this-numerical-scheme-so-much-faster-when-using-collect-than-a-for-loop/77949)._
