Tuwewe wrote:
> Thank you, Robert. That's great advice! I will keep them in mind while
> learning Ruby. If files become ridiculously large, there is always
> c/c++ there. But I really want to do as much work in Ruby as possible.
>
> I tried in place replacement and the use of << in stead of +, and my
> little test scripts run much faster (300% better).

:-)

> Could you elaborate  on "when processing large files process them
> streaming mode"? Do you mean using iterator such as
> IO.foreach("testfile") { |line| ........ }
> in stead of the way like
> arr = IO.readlines("testfile") ? Or is there another library I should
> look into?

No, that's exactly what I meant: If possible do it line by line instead of
slurping in the whole file and then doing the work.  (Of course there are
libs out there for specialized tasks, e.g. CSV parsing, but that's a
different story.)

> Thanks again for your help.

You're welcome!

Kind regards

    robert