Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] how to tune reiser4 for millions of files?
- Date: Thu, 28 Jan 2010 13:04:31 -0500
- From: Patrick Bernier <pat@example.com>
- Subject: Re: [tlug] how to tune reiser4 for millions of files?
- References: <20100128073847.GH13095@example.com> <20100128095957.GB24344@example.com> <20100128132701.GI13095@example.com> <87wrz2s08d.fsf@example.com>
- User-agent: Mutt/1.5.18 (2008-05-17)
Quoting Stephen J. Turnbull: > One thing: ls is possibly the slowest possible application imaginable, > because all it does is make syscalls. I would expect that the problem > is not the syscall overhead (although I bet that's non-negligible), I would tend to guess that his ls is trying to SORT the entire file listing before printing anything, which of course cannot be done before having loaded the ENTIRE file list in memory. Michal, when one needs to get the list of files from a big directory using the shell, using "find" is always the fastest way to go: a plain "find" will only call opendir, readdir and closedir, not bothering to stat the files or anything -- and will neither try to sort the output. Knowing how to pipe the result of find into xargs to get your files processed one by one is a very useful thing to learn for all shell users. One example: find . -print0 | xargs -0 -r -- ls -l ... will give you a detailed unsorted recursive file listing from the current directory. Note that xargs assumes by default that it can provide several filenames at once to the program it is calling; use the -L option to specify a limit, e.g. -L 1 if your program can only deal with one filename at once: find . -maxdepth 1 -type f -print0 | xargs -0 -L 1 -r -- ~/myprogram -print0 is important to deal with filenames that include special characters. -maxdepth 1 here means to not recurse into subdirectories. -type f means "only regular files", e.g. don't try to run my program on directories. See the manpages for all the amazing details. -- () Patrick (L.) Bernier <pat@example.com> () http://www.TZoNE.ORG/~pat/ () GPG B070 BBB6 188D EB1E 353A 90E4 96FF D8EB 1ADC BE03 () "Words have meaning, and names have power." -- Lorien
- Follow-Ups:
- Re: [tlug] how to tune reiser4 for millions of files?
- From: Michal Hajek
- References:
- [tlug] how to tune reiser4 for millions of files?
- From: Michal Hajek
- Re: [tlug] how to tune reiser4 for millions of files?
- From: Curt Sampson
- Re: [tlug] how to tune reiser4 for millions of files?
- From: Michal Hajek
- Re: [tlug] how to tune reiser4 for millions of files?
- From: Stephen J. Turnbull
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] how to tune reiser4 for millions of files?
- Next by Date: Re: [tlug] OSS network visualization software, WAS: [Semi-OT] Network connectivity diagnosis
- Previous by thread: Re: [tlug] how to tune reiser4 for millions of files?
- Next by thread: Re: [tlug] how to tune reiser4 for millions of files?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links