According to the docstring for timeit,
This method prints the timing information and does not return
anything, except if the option "seconds=True" was passed, in which
case the wall time in seconds is returned.
So timeit('...', seconds=True) might do what you want.
On Saturday, December 21, 2013 9:38:06 AM UTC-8, 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
> <[email protected]<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 <[email protected]>wrote:
>>>
>>>> Hi Kannappan,
>>>>
>>>>
>>>> On 2013-12-21, Kannappan Sampath <[email protected]> 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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>>
>>>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.