News for hackers. Stuff that matters.
Re:One Billion Files: Scalability Limits in Linux File Syste... by tyingq on Wednesday April 06, 2016 @10:33AM (#11438996)
Tested a few things. "ls -U" seems to be the fastest approach I could find. -U disables sorting.

  $ mkdir testdir && cd testdir # make 200k files
  $ perl -e 'for (1..200000) {open(FOO,">$_");close(FOO)}'

  $ time echo * >>/dev/null
  real	0m1.607s user 0m1.480s sys 0m0.128s
  $ time ls >> /dev/null
  real	0m1.458s user 0m1.324s sys 0m0.132s
  $ # globs
  $ time perl -e 'for (glob("*")) {print "$_\n"}' >>/dev/null
  real	0m0.679s user 0m0.404s sys 0m0.272s
  $ time find . -maxdepth 1 -print >> /dev/null
  real	0m0.239s user 0m0.128s sys 0m0.108s
  $ time ls -U >> /dev/null
  real	0m0.195s user 0m0.064s sys 0m0.132s

There are no comments on this comment yet.