# Easy way to run benchmarks quickly

**URL:** https://discourse.julialang.org/t/easy-way-to-run-benchmarks-quickly/70406
**Category:** Performance
**Tags:** benchmarktools
**Created:** [October 26, 2021, 2:11pm UTC](https://discourse.julialang.org/t/easy-way-to-run-benchmarks-quickly/70406 "2021-10-26T14:11:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)
#### Post date: [October 26, 2021, 2:11pm UTC](https://discourse.julialang.org/t/easy-way-to-run-benchmarks-quickly/70406/1 "2021-10-26T14:11:40Z")

</div>

Why does @benchmark take so long even when evals is manually specified?

```julia
using BenchmarkTools 
count = 0
@elapsed @benchmark (global count += 1; sleep(.05)) evals=1 samples=10 # 1.68
@elapsed for i in 1:count; sleep(.05) end # 0.587
count # 11

```

---

<div class="post-metadata">

### Author: ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)
#### Post date: [October 27, 2021, 11:48pm UTC](https://discourse.julialang.org/t/easy-way-to-run-benchmarks-quickly/70406/2 "2021-10-27T23:48:01Z")

</div>

Does it have to do with `Base.GC.gc()` being called before running the test?

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [October 27, 2021, 11:53pm UTC](https://discourse.julialang.org/t/easy-way-to-run-benchmarks-quickly/70406/3 "2021-10-27T23:53:03Z")

</div>

BenchmarkTools does a tuning step to figure out how many evaluations to perform; you can save these results, however, to re-use them: [Manual · BenchmarkTools.jl](https://juliaci.github.io/BenchmarkTools.jl/dev/manual/#Caching-Parameters)

edit: sorry, just realized you mentioned `evals` being manually specified which would skip the tuning step. Not sure then; maybe the GCing explains it like you said.
