ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-tutor
python-tutor
Re: [Tutor] why is os.path.walk so slow?
by Wayne Werner other posts by this author
Nov 4 2009 8:01AM messages near this date
Re: [Tutor] why is os.path.walk so slow? | Re: [Tutor] why is os.path.walk so slow?
On Wed, Nov 4, 2009 at 6:16 AM, Garry Willgoose <
garry.willgoose@[...].au>  wrote:

>  <snip>
> 
>  This is very fast for a directory on my local machine but significantly
>  slower on the remote machine. Not surprising but I would have expected that
>  the run time for the remote directory would be limited by my broadband speed
>  but when I look at upload/download in real time it's less than 10% of
>  maximum. Is this just par for the course or is there something I can do that
>  better utilizes my broadband bandwidth?


I'm not sure if there's a correlation, but there probably is. What OS are
you (and the remote system) using? What service are you using to connect?

By way of disclosure, I don't have a lot of experience in this category, but
I would venture that whatever service you're using has to send/receive
requests for each file/dir that os.walk checks.

I don't know precisely how os.walk works, but I'm guessing the differences
are as follows:

Local Machine:
python-> os.walk->local system calls

Remote Machine:
python-> os.walk->call to client->data through the tubes->remote host->system
calls

Even if that's not completely correct, you're still going to have extra
steps as you walk through the remote system, and the bottleneck will
probably not be on the internet connection (and your tests seem to verify
this).

It would work better, I think, if you were able to run a script on the
remote system and return the results.

HTH,
Wayne
Thread:
Garry Willgoose
Modulok
Garry Willgoose
Wayne Werner
Hugo Arts

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved