Re: iglob performance no better than glob

2010-02-13 Thread Cameron Simpson
On 31Jan2010 16:23, Kyp wrote: | On Jan 31, 2:44 pm, Peter Otten <__pete...@web.de> wrote: | > Kyp wrote: | > > I have a dir with a large # of files that I need to perform operations | > > on, but only needing to access a subset of the files, i.e. the first | > > 100 files. | > > Using glob is ver

Re: iglob performance no better than glob

2010-01-31 Thread Kyp
On Jan 31, 2:44 pm, Peter Otten <__pete...@web.de> wrote: > Kyp wrote: > > I have a dir with a large # of files that I need to perform operations > > on, but only needing to access a subset of the files, i.e. the first > > 100 files. > > > Using glob is very slow, so I ran across iglob, which retur

Re: iglob performance no better than glob

2010-01-31 Thread Kyp
On Jan 31, 1:06 pm, John Bokma wrote: > Kyp writes: > > Is there a way to get the first X # of files from a dir with lots of > > files, that does not take a long time to run? > > Assuming Linux: what does time > >  ls thedir | head > > give? > > with thedir the name of the actual dir about 3 seco

Re: iglob performance no better than glob

2010-01-31 Thread Benjamin Peterson
Kyp stsci.edu> writes: > So the iglob was faster, but accessing the first file took about the > same time as glob.glob. That would be because glob is implemented in terms of iglob. -- http://mail.python.org/mailman/listinfo/python-list

Re: iglob performance no better than glob

2010-01-31 Thread Peter Otten
Kyp wrote: > I have a dir with a large # of files that I need to perform operations > on, but only needing to access a subset of the files, i.e. the first > 100 files. > > Using glob is very slow, so I ran across iglob, which returns an > iterator, which seemed just like what I wanted. I could it

Re: iglob performance no better than glob

2010-01-31 Thread John Bokma
Kyp writes: > Is there a way to get the first X # of files from a dir with lots of > files, that does not take a long time to run? Assuming Linux: what does time ls thedir | head give? with thedir the name of the actual dir Also how many is many files? -- John Bokma

Re: iglob performance no better than glob

2010-01-31 Thread Skip Montanaro
> So the iglob was faster, but accessing the first file took about the > same time as glob.glob. I'll wager most of the time required to access the first file is due to filesystem overhead, not any inherent limitation in Python. Skip Montanaro -- http://mail.python.org/mailman/listinfo/python-