Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to properly time Sage computations?

I have written a Sage code that performs some calculations with elliptic curves, and I want to get how much time it took to finish the calculations. I saw that there is already a function called timeit, but what I see is that it basically times the given command. Instead what I need is that I want to time the execution of certain code block (for example, a loop). Assuming, I have a code segment as this:

for i in range(0, 100):
     # Do some calculations...

How can I get how much time it took to execute the code block (in this case the whole loop)?