Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #21785
| From | Jim Janney <jjanney@shell.xmission.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: The first 10 files |
| Date | 2013-01-26 20:57 -0700 |
| Organization | fat-tailed contagion |
| Message-ID | <ydntxq3z3ao.fsf@shell.xmission.com> (permalink) |
| References | (3 earlier) <amivb3Fag8iU1@mid.individual.net> <ke1k0f$nqj$1@dont-email.me> <1iop8bl8ysrfg$.rdxcxhgxuj1r$.dlg@40tude.net> <ke20lo$sh1$1@dont-email.me> <iV%Ms.125649$Id.75544@newsfe24.iad> |
Arved Sandstrom <asandstrom2@eastlink.ca> writes: > On 01/26/2013 09:42 PM, Eric Sosman wrote: >> On 1/26/2013 6:21 PM, Peter Duniho wrote: >>> On Sat, 26 Jan 2013 17:06:07 -0500, Eric Sosman wrote: >>> >>>> On 1/26/2013 4:15 PM, Robert Klemme wrote: >>>>> On 26.01.2013 19:26, Arne Vajhøj wrote: >>>>> >>>>>> But I am a bit skeptical about whether a String[] with 30K elements >>>>>> is really the bottleneck. >>>>>> >>>>>> If the real bottleneck is the OS calls to get next file, then >>>>>> a filter like this will not help. >>>>> >>>>> Why? >>>> >>>> Because the listFiles() method will fetch the information >>>> for all 30K files from the O/S, will construct 30K File objects >>>> to represent them, and will submit all 30K File objects to the >>>> FileFilter, one by one. The FileFilter will (very quickly) >>>> reject 29.99K of the 30K Files, but ... >>> >>> Will it? >> >> Necessarily. As far as listFiles() knows, the FileFilter >> might accept the very last File object given to it. Therefore, >> listFiles() cannot fail to present that very last File -- and >> every other File -- for inspection. > [ SNIP ] > > I'd have to agree. A simple test shows this to be the case, but your > reasoning precludes having to run such a test in the first place. > > My code "gets' the first N files from listFiles(), for some definition > of "first", but it certainly doesn't only get N files from the OS. > > Based on Wojtek's later post, I'd be examining the entire problem in > more detail before arriving at a decent solution. I don't think most > of the problem pertaining to offering reasonable batches of files to a > Java program for processing is something that I'd address in Java > anyway. There's also the problem of starvation, since we have no guarantees concerning the order of entries in the directory. -- Jim Janney
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The first 10 files Wojtek <nowhere@a.com> - 2013-01-26 01:14 -0800
Re: The first 10 files Roedy Green <see_website@mindprod.com.invalid> - 2013-01-26 02:44 -0800
Re: The first 10 files Lew <lewbloch@gmail.com> - 2013-01-26 10:20 -0800
Re: The first 10 files "John B. Matthews" <nospam@nospam.invalid> - 2013-01-26 06:31 -0500
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-01-26 15:42 -0800
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 17:13 -0700
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:21 -0500
Re: The first 10 files "John B. Matthews" <nospam@nospam.invalid> - 2013-01-26 22:05 -0500
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 08:24 -0400
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 08:25 -0400
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 13:26 -0500
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-01-26 22:15 +0100
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 16:25 -0500
Re: The first 10 files Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-26 17:06 -0500
Re: The first 10 files Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-26 15:21 -0800
Re: The first 10 files Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-26 20:42 -0500
Re: The first 10 files Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-26 17:56 -0800
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:29 -0500
Re: The first 10 files Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-26 21:56 -0500
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 20:51 -0700
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 20:47 -0700
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 22:02 -0400
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:35 -0500
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:43 -0500
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-01-27 13:55 +0100
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-02-24 17:50 -0500
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-02-25 21:53 +0100
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 20:57 -0700
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-01-26 21:20 -0800
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-27 07:23 -0400
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-27 20:36 -0500
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-01-28 16:28 -0800
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:23 -0500
Re: The first 10 files Roedy Green <see_website@mindprod.com.invalid> - 2013-01-26 19:09 -0800
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 16:00 -0700
Re: The first 10 files Knute Johnson <nospam@knutejohnson.com> - 2013-01-26 18:37 -0800
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-03-14 03:07 -0700
Re: The first 10 files lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-14 12:49 +0000
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-03-15 11:38 +0100
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-03-15 10:31 -0700
csiph-web