# The way of kings: efficiency of generators

**URL:** <https://discourse.julialang.org/t/the-way-of-kings-efficiency-of-generators/6854>\
**Category:** New to Julia\
**Tags:** question, performance, python, puzzles\
**Created:** [November 3, 2017, 7:06am UTC](https://discourse.julialang.org/t/the-way-of-kings-efficiency-of-generators/6854 "2017-11-03T07:06:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [November 3, 2017, 3:26pm UTC](https://discourse.julialang.org/t/the-way-of-kings-efficiency-of-generators/6854/2 "2017-11-03T15:26:58Z")

</div>

Not much optimization work has been done for this kind of usage of generators because if you really care about high performance you wouldn’t use generators like this in the first place. It would be nice to eventually make this faster, but it’s not a super high priority. I would recommend writing this in terms of straightforward iteration and recursion to get better performance.

---

_[View the full topic](https://discourse.julialang.org/t/the-way-of-kings-efficiency-of-generators/6854)._
