Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: greater efficiency required (ls, glob, or readdir?)

by superfrink (Curate)
on Aug 28, 2008 at 04:48 UTC ( #707380=note: print w/ replies, xml ) Need Help??


in reply to greater efficiency required (ls, glob, or readdir?)

ls sorts the list of files by default. If you don't care about the order of the files you can shave off a bit of time. ls -f will turn off sorting.

The difference you see will depend on your filesystem and you will have to try it out to see how much faster it is. In my experience there is a small difference with ReiserFS but there is a noticeable difference with Solaris UFS.


Comment on Re: greater efficiency required (ls, glob, or readdir?)
Select or Download Code
Re^2: greater efficiency required (ls, glob, or readdir?)
by Hue-Bond (Priest) on Aug 28, 2008 at 05:51 UTC
    ls -f will turn off sorting.

    The man page for ls on my linux system states that ls -f is equivalent to enabling -a (among other things). This would change the behaviour regarding plain ls so I would recommend using ls -U instead.

    --
    David Serrano

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://707380]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2014-10-21 15:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (105 votes), past polls