You can do this to get a return value, though its not particularly 
user-friendly. It would be nice if timeit would return a ElapsedTime class 
(or so) that can easily be converted/compared. In any case:

import sage.misc.sage_timeit_class
s = sage.misc.sage_timeit.sage_timeit('10^10', globals())
str(s)
s.series



On Saturday, December 21, 2013 5:38:06 PM UTC, KnS wrote:
>
> Hi Volker, 
>
> Thank you for the answer. We want just the time part of the output and 
> capture it in a variable if possible. The return type of the timeit() 
> function seems to be None. So, how do you work around it?
>
> With Sincere Regards, 
> Kannappan.
>
>
> On Sat, Dec 21, 2013 at 10:04 PM, Volker Braun 
> <vbrau...@gmail.com<javascript:>
> > wrote:
>
>> Use timeit() for precise measurements. Note that it measures wall time, 
>> not cpu time.
>>
>>
>>
>> On Saturday, December 21, 2013 4:29:19 PM UTC, KnS wrote:
>>
>>> Hi! 
>>>
>>> Thank you! That was helpful! But, we have  just observed the following 
>>> problems with this command. First of all, there are no subprocesses being 
>>> called, as far as I can see. We are just working with block_matrix(), 
>>> matrix() commands, which are native to sage. 
>>>
>>> But, even with this, given one's hope that larger dimension matrices 
>>> should take longer time to build (here, we are relying on a recursion, so 
>>> this must be true!), we have the following very irregular data: 
>>>
>>> e = 2 : 0.104
>>> e = 3: 0.024
>>> e = 4: 0.004
>>> e = 5: 0.004
>>> e = 6: 0.016
>>> e = 7: 0.012
>>> e = 8: 0.028
>>> e = 9: 0.092
>>> e = 10: 0.348
>>> e = 11: 1.468
>>>
>>> In each of these cases, we were building a 2^e x 2^e matrix by a 
>>> recursion on e. 
>>>
>>> We are interested in having an as precise data as we can about the run 
>>> time of this process. I'd appreciate any help in this regards. 
>>>
>>> With Sincere Regards, 
>>> Kannappan. 
>>>
>>>
>>>
>>>
>>> On Sat, Dec 21, 2013 at 3:17 PM, Simon King <simon...@uni-jena.de>wrote:
>>>
>>>> Hi Kannappan,
>>>>
>>>>
>>>> On 2013-12-21, Kannappan Sampath <kntr...@gmail.com> wrote:
>>>> > I'd like to know how to get some idea on the runtime of a certain 
>>>> program.
>>>> > In particular, I'd like to know the following:
>>>> >
>>>> > how to run the program for various values of input, say parametrised 
>>>> by the
>>>> > set of positive integers and extract the cpu time required for the
>>>> > computation.
>>>>
>>>> Is the "cputime" function what you are looking for? As usual, you can
>>>> see the documentation of it by
>>>>   sage: cputime?<hit return>
>>>>
>>>> Note that this will give you the cputime of the Sage process. In some
>>>> applications, stand-alone programs such as Singular or Gap or Maxima or
>>>> (if available) Magma will be invoked. cputime would not give you the
>>>> cpu-time of these sub-processes.
>>>>
>>>> Best regards,
>>>> Simon
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "sage-support" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to sage-support...@googlegroups.com.
>>>> To post to this group, send email to sage-s...@googlegroups.com.
>>>>
>>>> Visit this group at http://groups.google.com/group/sage-support.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sage-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-support...@googlegroups.com <javascript:>.
>> To post to this group, send email to sage-s...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/sage-support.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to