# Speed of vectorized vs for-loops using Zygote

**URL:** <https://discourse.julialang.org/t/speed-of-vectorized-vs-for-loops-using-zygote/40556>\
**Category:** Performance\
**Tags:** zygote, tullio\
**Created:** [June 1, 2020, 12:40pm UTC](https://discourse.julialang.org/t/speed-of-vectorized-vs-for-loops-using-zygote/40556 "2020-06-01T12:40:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 1, 2020, 1:00pm UTC](https://discourse.julialang.org/t/speed-of-vectorized-vs-for-loops-using-zygote/40556/3 "2020-06-01T13:00:12Z")

</div>

> [@roflmaostc](#):
>
> Zygote fails completely (in terms of performance) on the for-loop function. The vectorized is ok.  
> But Zygote is roughly 5-10x slower than the function itself.

That’s expected with the current Zygote. I would swap out to ReverseDiff.jl with tape compilation if you’re doing a lot of scalar computations.

---

_[View the full topic](https://discourse.julialang.org/t/speed-of-vectorized-vs-for-loops-using-zygote/40556)._
