# A generator with two "for" keywords is slow

**URL:** <https://discourse.julialang.org/t/a-generator-with-two-for-keywords-is-slow/7407>\
**Category:** Performance\
**Created:** [November 30, 2017, 9:29am UTC](https://discourse.julialang.org/t/a-generator-with-two-for-keywords-is-slow/7407 "2017-11-30T09:29:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [November 30, 2017, 4:09pm UTC](https://discourse.julialang.org/t/a-generator-with-two-for-keywords-is-slow/7407/3 "2017-11-30T16:09:47Z")

</div>

You are timing in global scope. Wrap everything in a function or use BenchmarkTools.jl instead.

EDIT: `v` is in global scope.

EDIT: Nonetheless, your observation seems to be correct.

---

_[View the full topic](https://discourse.julialang.org/t/a-generator-with-two-for-keywords-is-slow/7407)._
