Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #25726
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: deleting files |
| Date | 2011-01-28 16:53 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <ihvds0$19f$1@news.eternal-september.org> (permalink) |
| References | <kc46k65u61goegok3j9heoc5t5juh78k13@4ax.com> |
On 01/28/2011 02:00 PM, Roedy Green wrote: > I wrote a program to tidy up my hard disk. I run it as administrator. > It tells me there are a fair number of junk files I cannot delete. I > have a utility, presumably written in C, that much more rapidly scans > my drive for junk and manages to wipe out much of the junk I could > not. > > I curious if anyone has experimented and could tell me: > > 1. why in the C utility is so much faster than my utility. My code is > basically just a bunch of File.list() with filters. What Java doing to > dither? It is possible that the utility could be reading disk blocks directly and reading the entire directly listing as it exists on the disk instead of using the OS APIs. Another point of interest is that Java constructs the array by building a 16-element array, growing that à la ArrayList by doubles, and then copies that back into the output array, which could be slow for directories with a few thousand directory entries. A final thing to note that it is possible that the utility is moving faster because the files it is checking is already cached. You should try observing the speed difference if you when the unknown utility first and then the Java utility later. > 2. What is the utility doing to let it kill more files? Of course, the real answer may be that the utility is doing something completely different which is faster than your approach. Listing directories can actually be very computationally expensive on FAT (and I think NTFS as well?) simply because of how the filesystem works... -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
deleting files Roedy Green <see_website@mindprod.com.invalid> - 2011-01-28 11:00 -0800 Re: deleting files Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-01-28 16:53 -0500 Re: deleting files Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-01-28 18:05 -0400
csiph-web