Thanks, I'll try it.
Cheers Gustavo

On Jul 14, 10:42 pm, Simon King <simon.k...@uni-jena.de> wrote:
> Hi Gustavo!
>
> On 15 Jul., 03:17, Gustavo Rama <gdr...@gmail.com> wrote:
>
> > But how con you get the time of execution in a variable?
>
> Using cputime or walltime: No problem, since they return a number.
>
> Using timeit:
>
> Remember that you could obtain a timing doing
>   sage: timeit('f=factorial(400).factor()')
>   625 loops, best of 3: 955 µs per loop
>
> In order to assign the result of the timing to a variable, do
>
>   sage: T = timeit.eval('f=factorial(400).factor()')
>
> Then, the necessary information is contained in the attribute 'stats'
> of T:
>
>   sage: T.stats
>   (625, 3, 3, 953.62396240234375, '\xc2\xb5s')
>
> So, the first entry gives the number of loops, the second the number
> of runs, the third I don't understand,  the fourth gives the
> computation time, with units given by the last entry. Anyway:
>
>   sage: print "%d loops, best of %d: %.*g %s per loop" % T.stats
>   625 loops, best of 3: 954 µs per loop
>
> Note that this only gives the walltime. Note also that it is not so
> nice to compare different timings: It might be that one timing
> measures the time in microseconds and the other in milliseconds - IMHO
> this is an oddity.
>
> Cheers,
>    Simon
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to