[Tutor] question about run time

Kent Johnson kent37 at tds.net
Tue May 2 21:26:46 CEST 2006


Ertl, John wrote:
> Kent,
> 
> The files are very small (a few hundred lines).  Maybe it is a network
> issue? But then why is it always slow the first time in the morning?  I
> don't know network stuff but that seams a bit strange.

Maybe the network access is slow and the files are cached locally after 
the first access? I think Windows does this...

Some things you might want to try:
- Open one of the files in a text editor. Close it and open it again. Is 
it faster the second time?
- Write a simple python program to open one of the files and read it. Is 
it faster the second time you run it?

HTH, I'm guessing here. I have definitely seen scripts that run faster 
the second time and attribute it to file caching somewhere...though I 
haven't seen such a significant difference as you.

Kent

> 
> Thanks,
> 
> John Ertl 
> 
>  -----Original Message-----
> From: 	Kent Johnson [mailto:kent37 at tds.net] 
> Sent:	Tuesday, May 02, 2006 12:06 PM
> To:	Ertl, John
> Cc:	tutor at python.org
> Subject:	Re: [Tutor] question about run time
> 
> Ertl, John wrote:
>> I have been using python for sometime...and occasionally I noticed
>> significant delay before the code would run but unitl now I have been able
>> to write it off to other things.  Now I have a short script that I wrote
> to
>> check some files and print out a few lines.
>>
>> I have noticed that usually the first time I fire it up in the morning or
>> after a long time of not running it, it takes 10-15 seconds to run and the
>> output to the screen is very slow...maybe 1 second per line.  If I run it
>> soon after that it runs and the output is on the screen in less then a
>> second.  I would think this has to do with compiling but I am not sure.
> Any
>> ideas how to speed this up?  
> 
> Compiling is not that slow. Are you files huge? Possibly they are in the 
> disk cache after the first run.
> 
> Kent
> 
> 
> 




More information about the Tutor mailing list