Le mercredi 03 février 2016 à 12:55 -0800, Christopher Alexander a
écrit :
> Try doing something like:
> 
> tic()
> # my code
> toc()
Be careful with tic() and toc() in Julia. In most cases, when
benchmarking, you should wrap your code in a function to make sure it
gets specialized on the argument types, instead of running it from the
REPL. So in general it's better to do:
@time myfun(arg1, arg2, ...)

See http://docs.julialang.org/en/latest/manual/performance-tips/#measur
e-performance-with-time-and-pay-attention-to-memory-allocation


Regards

> On Wednesday, February 3, 2016 at 3:28:28 PM UTC-5, Lytu wrote:
> > Hello Julia users,
> > 
> > Can someone tell me what's the equivalent of matlab elapsed cputime
> > in Julia
> > 
> > For example i Matlab, we can do this:
> >    t = cputime;
> >    x=4;
> >    iter = 1; 
> >    z = ones(1,4);
> >    y=x*2*z;
> >    e = cputime-t
> > 
> > But in Julia i don't seem to find how to do this. I thought i can
> > use 
> >    t=time()
> >    x=4;
> >    iter = 1; 
> >    z = ones(1,4);
> >    y=x*2*z;
> >    e=time()-t
> > 
> > But time() in Julia is not the elapsed CPU time, it's a wall clock
> > time.
> > 
> > Can someone help me?
> > 
> > Thank you
> > 

Reply via email to