# How to measure performance with @time?

**URL:** <https://discourse.julialang.org/t/how-to-measure-performance-with-time/81150>\
**Category:** New to Julia\
**Tags:** question, performance, benchmark\
**Created:** [May 16, 2022, 1:38pm UTC](https://discourse.julialang.org/t/how-to-measure-performance-with-time/81150 "2022-05-16T13:38:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamp](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vamp](https://discourse.julialang.org/u/vamp)\
**Post date:** [May 16, 2022, 1:38pm UTC](https://discourse.julialang.org/t/how-to-measure-performance-with-time/81150/1 "2022-05-16T13:38:11Z")

</div>

Hello,

I want to measure how long the following solver takes:

```julia
#Q-Learning solver
q_learning_solver = QLearningSolver(n_episodes=1000, 
                                max_episode_length = 1000,
                                learning_rate= 0.001
                                exploration_policy= EpsGreedyPolicy(mdp,0.01), 
                                eval_every = 100, 
                                n_eval_traj = 20, 
                                verbose=true)
q_learning_policy = solve(q_learning_solver, mdp)

```

I have tried `@time q_learning_policy` but it doesn`t work. What is the correct way to use `@time `?

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [May 16, 2022, 1:44pm UTC](https://discourse.julialang.org/t/how-to-measure-performance-with-time/81150/2 "2022-05-16T13:44:46Z")

</div>

You should try

```julia
@time q_learning_policy = solve(q_learning_solver, mdp)

```

---

<div class="post-metadata">

**Author:** ![moeddel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moeddel/32/18641_2.png) [@moeddel](https://discourse.julialang.org/u/moeddel)\
**Post date:** [May 16, 2022, 1:46pm UTC](https://discourse.julialang.org/t/how-to-measure-performance-with-time/81150/3 "2022-05-16T13:46:44Z")

</div>

Please consider using [BenchmarkTools](https://github.com/JuliaCI/BenchmarkTools.jl) for measuring performance.

---

<div class="post-metadata">

**Author:** ![vamp](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vamp](https://discourse.julialang.org/u/vamp)\
**Post date:** [May 16, 2022, 1:48pm UTC](https://discourse.julialang.org/t/how-to-measure-performance-with-time/81150/4 "2022-05-16T13:48:47Z")

</div>

Hello,

Thanks it worked!
