I don't think there's a way to speed up much your start
method; it does the correct things of going through your files and processing them as soon as it encounters them. You can probably simplify it with a single Dir.glob do
, but it will still be slow. I suspect that this is not were most of the time is spent.
There very well might be a way to speed up your extract
method, impossible to know without the code.
The other way to speed this up might be to split the processing to multiple processes. Since reading & writing is probably what is slowing you down, this way would give you hope that the ruby code executes while another process is waiting for the IO.