# Running a function inside BenchmarkTools breaks it

**URL:** <https://discourse.julialang.org/t/running-a-function-inside-benchmarktools-breaks-it/21901>\
**Category:** General Usage\
**Created:** [March 15, 2019, 7:57am UTC](https://discourse.julialang.org/t/running-a-function-inside-benchmarktools-breaks-it/21901 "2019-03-15T07:57:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xor0110](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xor0110/32/7926_2.png) [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Post date:** [March 15, 2019, 7:57am UTC](https://discourse.julialang.org/t/running-a-function-inside-benchmarktools-breaks-it/21901/1 "2019-03-15T07:57:43Z")

</div>

This post was temporarily hidden by the community for possibly being off-topic, unfocused, inappropriate, or spammy.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 15, 2019, 8:13am UTC](https://discourse.julialang.org/t/running-a-function-inside-benchmarktools-breaks-it/21901/2 "2019-03-15T08:13:16Z")

</div>

> [@xor0110](#):
>
> Running this function normally it stops, but calling it with `@btime` creates an infinite loop. What is going on here?

Looks like a normal timing loop to me. By default BenchmarkTools runs the function multiple times to get better measurement data. At least for me it finishes after a few seconds.

---

<div class="post-metadata">

**Author:** ![xor0110](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xor0110/32/7926_2.png) [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Post date:** [March 15, 2019, 8:15am UTC](https://discourse.julialang.org/t/running-a-function-inside-benchmarktools-breaks-it/21901/3 "2019-03-15T08:15:30Z")

</div>

Yikes, sorry about that, it’s too early in the morning!!
