Ask Your Question

Revision history [back]

As suggested by @fidbc, it is very likely that your second test is much slower than the other ones because of the following heavy stack: Sage runs on Linux which is emulated by virtualbox which runs on windows! This may also explain why, in this second case, the wall time is much bigger than the CPU time: the wall time also counts the time spent for letting the stack work and the communications among parts of the stack.

Also, this might be due to the fact that an external greedy process in running during your test. To circumvent this possibility, you can use %timeit instead of %time: your test will be run several times and will select the fastest one.

If you want to run Sage on your local machine, i strongly advise to install Linux on an additionnal partition and run Sage directly from it. A lighter solution could be to boot from a live USB key that includes Sage. If you make some tests with those configurations, i would like to see the difference.

If you are interested in saving time without much coding effort, you may be interested in the @parallel decorator.