A
Alex Maccaw
I have a file based msg queue, and msgs are stored five folders down.
When a request for the next msg is received, I need to grab the first
file I can find, as fast as I can.
I've tried Dir.glob, and only selecting the first file. This however is
an awful way of doing it as it loads every file into memory, before
selecting the first.
A bit better is Find.find, which finds files incrementally. However,
this still takes about 0.005 seconds (I presume since it's also
'finding' directories').
Is there a faster way to do this?
When a request for the next msg is received, I need to grab the first
file I can find, as fast as I can.
I've tried Dir.glob, and only selecting the first file. This however is
an awful way of doing it as it loads every file into memory, before
selecting the first.
A bit better is Find.find, which finds files incrementally. However,
this still takes about 0.005 seconds (I presume since it's also
'finding' directories').
Is there a faster way to do this?