[ftputil] Ftputil seems really slow to distinguish file and folders

MailingList SVR lists at svrinformatica.it
Thu Apr 30 23:50:03 CEST 2009


In data giovedì 30 aprile 2009 21:54:11, Stefan Schwarzer ha scritto:
: > Hello Nicola,
> 
> What I like about your reports is that you always provide
> concrete examples with working test code. Great! :-)

and your answers are ever rich of quality valuable infos, thanks!

> 
> On 2009-04-29 22:46, MailingList SVR wrote:
> > I need to distinguish beetween file and folder, I'm using
> > host.path.isdir and host.path.isfile but these seems really slow.
> > 
> > Here is an example code:
> > 
> > host=ftputil.FTPHost('ftp.nluug.nl','anonymous','pippo at pippo.com')
> > folder='/vol/1/centoslinux/5.3/os/SRPMS/'
> > lista=host.listdir(folder)
> > 
> > # host.listdir is fast, good!
> >
> > for l in lista:
> >         print folder+l
> >         print datetime.datetime.now()
> >        #host.path.isdir and isfile are slow :-(
> >         if host.path.isdir(folder+l):
> >                 print 'dir:'
> >                 print datetime.datetime.now()
> >         if host.path.isfile(folder+l):
> >                 print 'file:'
> > 
> > and this is the output:
> > [...]
> 
> Running this with ftputil 2.4 on my computer takes about
> 25 minutes. When increasing the cache size to 2000, the code
> runs in about 40 seconds. :)
>

works in about 40 seconds on my box too, this time is acceptable, however on the same directory a standard ftpclient give the directory listing in few seconds. I haven't look at ftputil code but host.listdir is fast such as filezilla and company (2-3 seconds) what other tasks ftputil does in about 35 seconds? It is possible to have a fastest listing or the code is already optimized?

thanks
Nicola




> For the details, please read this section of the ftputil
> documentation:
> 
> http://ftputil.sschwarzer.net/trac/wiki/Documentation#local-caching-of-file-system-information
> 
> (context: the directory you work on has 1193 items in it, and
> ftputil's default cache size is 1000)
>
> Best regards,
> Stefan
> _______________________________________________
> ftputil mailing list
> ftputil at codespeak.net
> http://codespeak.net/mailman/listinfo/ftputil
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/ftputil/attachments/20090430/1168d89a/attachment.htm 


More information about the ftputil mailing list