Re: Faster os.walk()

2005-04-20 Thread fuzzylollipop
ding, ding, ding, we have a winner. One of the guys on the team did just this, he re-implemented the os.walk() logic and embedded the logic to the S_IFDIR, S_IFMT and S_IFREG directly into the transversal code. This is all going to run on unix or linux machines in production so this is not a big

Re: Faster os.walk()

2005-04-20 Thread Lonnie Princehouse
If you're trying to track changes to files on (e.g. by comparing current size with previously recorded size), fam might obviate a lot of filesystem traversal. http://python-fam.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Faster os.walk()

2005-04-20 Thread Nick Craig-Wood
fuzzylollipop <[EMAIL PROTECTED]> wrote: > I am trying to get the number of bytes used by files in a directory. > I am using a large directory ( lots of stuff checked out of multiple > large cvs repositories ) and there is lots of wasted time doing > multiple os.stat() on dirs and files from di

Re: Faster os.walk()

2005-04-20 Thread Kent Johnson
fuzzylollipop wrote: after extensive profiling I found out that the way that os.walk() is implemented it calls os.stat() on the dirs and files multiple times and that is where all the time is going. os.walk() is pretty simple, you could copy it and make your own version that calls os.stat() just o

Re: Faster os.walk()

2005-04-20 Thread Philippe C. Martin
How about rerouting stdout/err and 'popening" something like /bin/find -name '*' -exec a_script_or_cmd_that_does_what_i_want_with_the_file {} \; ? Regards, Philippe fuzzylollipop wrote: > du is faster than my code that does the same thing in python, it is > highly optomized at the os leve

Re: Faster os.walk()

2005-04-20 Thread fuzzylollipop
du is faster than my code that does the same thing in python, it is highly optomized at the os level. that said, I profiled spawning an external process to call du and over the large number of times I need to do this it is actually slower to execute du externally than my os.walk() implementation.

Re: Faster os.walk()

2005-04-20 Thread Peter Hansen
Laszlo Zsolt Nagy wrote: fuzzylollipop wrote: I am trying to get the number of bytes used by files in a directory. I am using a large directory ( lots of stuff checked out of multiple large cvs repositories ) and there is lots of wasted time doing multiple os.stat() on dirs and files from different

Re: Faster os.walk()

2005-04-20 Thread Laszlo Zsolt Nagy
fuzzylollipop wrote: I am trying to get the number of bytes used by files in a directory. I am using a large directory ( lots of stuff checked out of multiple large cvs repositories ) and there is lots of wasted time doing multiple os.stat() on dirs and files from different methods. Do you need