Program inefficiency?

Michael.Coll-Barth at Michael.Coll-Barth at
Sat Sep 29 18:07:52 CEST 2007


> -----Original Message-----
> From: hall.jeff at
> the program works great except for one thing. It's significantly
> slower through the later files in the search then through the early
> ones... Before anyone criticizes, I recognize that that middle section
> could be simplified with a for loop... I just haven't cleaned it
> up...
> The problem is that the first 300 files take about 10-15 seconds and
> the last 300 take about 2 minutes... If we do more than about 1500
> files in one run, it just hangs up and never finishes...
> Is there a solution here that I'm missing? What am I doing that is so
> inefficient?

You did not mention the OS, but because you are using
"pathname\editfile.txt", it sounds like you are using an MS OS.  From
past experience with various MS OSes, I found that as the number of
files in a directory increases the slower your process runs for each
file.  You might try putting these files into multiple sub-directories.

The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure.  If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof.  Thank you.

More information about the Python-list mailing list