# BenchmarkTools.jl and Juno

**URL:** https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849
**Category:** New to Julia
**Tags:** question
**Created:** [December 10, 2016, 6:04pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849 "2016-12-10T18:04:55Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Aleksandr\_Mikheev](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)
#### Post date: [December 10, 2016, 6:04pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/1 "2016-12-10T18:04:55Z")

</div>

Hello,

I am currently trying to compare a performance of two codes. For this purpose, I decided to choose BenchmarkTools. However, I cannot fully understand how to obtain necessary information in Juno. Consider the example from the manual:

```julia
using BenchmarkTools
@benchmark sin(1)

```

If I do this in terminal, I get what expect:

```julia
BenchmarkTools.Trial:
  memory estimate: 0.00 bytes
  allocs estimate: 0
  --------------
  minimum time: 14.605 ns (0.00% GC)
  median time: 15.790 ns (0.00% GC)
  mean time: 16.843 ns (0.00% GC)
  maximum time: 78.158 ns (0.00% GC)
  --------------
  samples: 10000
  evals/sample: 1000
  time tolerance: 5.00%
  memory tolerance: 1.00%

```

However, if I do the same thing in Juno, the result is a bit different:

```julia
BenchmarkTools.Trial
params → 
BenchmarkTools.Parameters
times → Float64[10000]
gctimes → Float64[10000]
memory → 0
allocs → 0

```

I believe that, for instance, the array _times_ should correspond to the times in all samples. But where can I find the mean time, minimum time, etc? I tried to open every directory in this _BenchmarkTools.Trial_, but no. Neither had I found information about this in package’s documentation. What should I do?

Thank you in advance.

---

<div class="post-metadata">

### Author: ![jrevels](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jrevels/32/10393_2.png) [@jrevels](https://discourse.julialang.org/u/jrevels)
#### Post date: [December 10, 2016, 6:44pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/2 "2016-12-10T18:44:35Z")

</div>

The various estimates are not stored in `BenchmarkTools.Trial`, but are rather calculated on the fly as part of the type’s `show` method.

Documentation on how to compute these estimates can be found in the [BenchmarkTools manual](https://github.com/JuliaCI/BenchmarkTools.jl/blob/master/doc/manual.md#trial-and-trialestimate) as well as in the [API reference](https://github.com/JuliaCI/BenchmarkTools.jl/blob/master/doc/reference.md#minimumxuniontrial-benchmarkgroup); long story short, you can just call `mean(::Trial)`, `median(::Trial)`, etc.

---

<div class="post-metadata">

### Author: ![Aleksandr\_Mikheev](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)
#### Post date: [December 10, 2016, 6:52pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/3 "2016-12-10T18:52:12Z")

</div>

Thank you very much!

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [December 10, 2016, 7:40pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/4 "2016-12-10T19:40:15Z")

</div>

I think Juno just displays the internal fields like you see here if there isn’t a dedicated `render` method for that type of object. However, if I am not mistaken, this has been changed on the master version of Juno.

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [December 10, 2016, 8:15pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/5 "2016-12-10T20:15:00Z")

</div>

Since the latest version of Juno.jl (0.2.5), this shouldn’t actually happen:

![](https://global.discourse-cdn.com/julialang/original/3X/0/5/051f5dcf060ced1f920e2323526bbef40e91246d.png)

Have you `Pkg.update()`d recently?

---

<div class="post-metadata">

### Author: ![Aleksandr\_Mikheev](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)
#### Post date: [December 10, 2016, 11:53pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/6 "2016-12-10T23:53:18Z")

</div>

Yeah, I haven’t been updating for some time. Thank you very much for reply and for reminding me to finally update packages. 🙂

---

<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: [December 11, 2016, 12:06am UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/7 "2016-12-11T00:06:42Z")

</div>

> [@Aleksandr\_Mikheev](#):
>
> Yeah, I haven’t been updating for some time. Thank you very much for reply and for reminding me to finally update packages. 🙂

Julia moves fast. Last month’s packages are very different. For the time being (pre-1.0), I would update early and often. And most of the time when you encounter an error / depwarn, the answer is probably to update the package first (and then if that doesn’t fix it, you can checkout master. Or else… bingo you found it first! (is that a good thing?)).

---

<div class="post-metadata">

### Author: ![Paethon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paethon/32/9278_2.png) [@Paethon](https://discourse.julialang.org/u/Paethon)
#### Post date: [June 21, 2017, 12:27pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/8 "2017-06-21T12:27:50Z")

</div>

Has this changed again? Using Juno 0.2.7 and updated all packages. If I am using `@benchmark` I still only get a `Trial` type back

---

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [June 21, 2017, 1:10pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/9 "2017-06-21T13:10:25Z")

</div>

This has changed with the recently released Juno version. Full results are back.

---

<div class="post-metadata">

### Author: ![Paethon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paethon/32/9278_2.png) [@Paethon](https://discourse.julialang.org/u/Paethon)
#### Post date: [June 21, 2017, 2:43pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/10 "2017-06-21T14:43:43Z")

</div>

Thanks. Do I have to do something special to update? A simple `Pkg.update()` does not seem to go beyond 0.2.7

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [June 21, 2017, 3:33pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/11 "2017-06-21T15:33:44Z")

</div>

The latest version of Juno only works on Julia 0.6.

---

<div class="post-metadata">

### Author: ![Paethon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paethon/32/9278_2.png) [@Paethon](https://discourse.julialang.org/u/Paethon)
#### Post date: [June 21, 2017, 4:07pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/12 "2017-06-21T16:07:40Z")

</div>

That would explain it. Thanks 🙂

---

<div class="post-metadata">

### Author: ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)
#### Post date: [December 25, 2019, 6:47pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/13 "2019-12-25T18:47:08Z")

</div>

BenchmarkTools in Atom/Juno doesn’t show any output. If I run the example script below via “Juno/Run All”, there is a pause, but nothing happens

```julia
using BenchmarkTools 
@benchmark sin(1)

```

If however I run just the line via “Juno/Run Block”, I can display the results.  
Windows 10, Julia 1.3.0, Atom/Juno recently installed.

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [January 3, 2020, 8:09pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/14 "2020-01-03T20:09:21Z")

</div>

`@benchmark` _returns_ the result, it doesn’t display it. So either try `display(@benchmark sin(1))` or run that block in the REPL or, as your already noted, with inline evaluation.

---

<div class="post-metadata">

### Author: ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)
#### Post date: [January 3, 2020, 8:20pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-and-juno/849/15 "2020-01-03T20:20:36Z")

</div>

@pfitzseb thank you! `display(@benchmark sin(1))` works as expected.
