From: Daniel Brumbaugh Keeney Date: 2008-03-06T05:09:23+09:00 Subject: Re: Better performance than native unix commands? On Mon, Mar 3, 2008 at 10:21 PM, Markus Arike wrote: > > Ma Sa wrote: > > I have an issue with nfs and listing a large amount of files that I am > > wondering if I can solve with ruby. I know that ruby has better > > performance in some instances than a bash shell script so I am wondering > > if anyone has experience or some examples of how this might work... > > > > I have a directory with a large amount of files that is mounted over > > nfs. The network is gigabit and so are the nic's. The servers are very > > high end so the hardware / network performance is not the bottleneck. > > However, sometimes it can take a very long time to list out the files > > contained within a directory. > > > > I will do an ls and it might take 5 minutes to retrieve a response. > > > > Would this be faster if I were to do the same ls function using the ruby > > api? > > The only way to know for sure would be make some simple tests. I must beg to differ. Ruby doesn't stand a chance of being as fast as your system's ls. > ls does appear to be faster, but I'm sure others on this list know a > better Ruby way than that iterating over a Dir object. > > Markus The method you're looking for is Dir.foreach('.') Daniel Brumbaugh Keeney