From: Robert Klemme Date: 2008-01-08T22:22:42+09:00 Subject: Re: Finding the first file in a dir, fast, for message queue 2008/1/8, Alex Maccaw : > > You find 5ms when accessing the file system long? I'd say that's > > pretty fast considering what you do (recursive search). I doubt you > > will get much improvement as long as you always access the file system > > for your search. If you know the change frequency of files then you > > could store file system contents in memory and only update every n > > seconds / minutes or whatever or have a background thread that > > continuously updates your in memory representation. > > > Well, it's long compared to generating folder names, a guid, and writing > files. It means that I can publish about 1000 msgs per second on to my > queue, but only pull of 243 msgs per second. Here's another option: find all files and put them in a queue. Only redo search when the queue is empty. This might pay off over all. robert -- use.inject do |as, often| as.you_can - without end