Why is it faster the second time ?

J

jalanb3

Hello the group,

I am wondering why doctests run slower the first time.
In the transcript below "try" is a script which finds and runs
doctests in the current directory. It also shows how long it takes to
run these tests.

I added a new test which searches recursively for files given a path,
and it took (approx) 3 seconds to run. But all subsequent runs take
less than half a second.

Am I right in thinking that the extra time on the first run is the
time it takes to compile .py -> .pyc ?

Transcript follows

$ try paths.test

try ./paths.test; 10 tests passed in 3 seconds
10 tests passed, 0 failed, in 3 seconds

$ try paths.test

try ./paths.test; 10 tests passed very quickly
10 tests passed, 0 failed, in 0 seconds

$ try paths.test

try ./paths.test; 10 tests passed very quickly
10 tests passed, 0 failed, in 0 seconds
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top