Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Unix shell ls vs readdir

by Anonymous Monk
on Feb 06, 2012 at 12:06 UTC ( [id://952071]=note: print w/replies, xml ) Need Help??


in reply to Re: Unix shell ls vs readdir
in thread Unix shell ls vs readdir

so what do you think ? in terms of reading the 2Lac of files which one is better in performance ? ls or readdir ?

Replies are listed 'Best First'.
Re^3: Unix shell ls vs readdir
by graff (Chancellor) on Feb 07, 2012 at 02:10 UTC
    I don't know what "the 2Lac of files" is supposed to mean, and "performance" is either too dependent on unknown factors, or else simply irrelevant. Enough practical reasons have been cited to favor the readdir/readlink approach (ease and reliability of file name handling, vs. somewhat more difficult and trouble-prone string parsing), and in some circumstances, running a subshell to run "ls" could be slower than using readdir/readlink.

    If a timing difference between the two methods really matters (which is rarely true), then doing a benchmark "in context" (i.e. under the same conditions as production use) would be prudent.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found