I have a set of programs which I was trying to get working on a HUGE file (system logs), and found that replacing a scan through the system logs for lines containing a particular string, that 'grep' was *MUCH* quicker than Ruby - but that is probably not a good comparison, eh?

>>> Dave / thomases.com 7/21/00 10:56p >>>
"me" <dennisn / pe.net> writes:

> For most stuff it may not matter.  But for some stuff it would
> be nice to know.  Ex:  sorting 100,000 line text file, or searching
> it for lines containing the string "peachblossom".  Thx.

I'm in the middle of putting together some numbers on this. The simple 
answer is: it depends. For some tasks it's comparable with Perl and
faster than Python. For others, particularly things where Perl is just 
hacking strings and Ruby is doing lots of object creation, Ruby can
come out slower.

On my current figures the sort and the grep that you asked about would 
be roughly the same between the two languages. (For example, to find
lines containing the word 'Rock' in a 32,000 line file, Ruby takes
about .7s, and Perl .64).

I'll be soliciting more input on benchmarks when my time starts to
free up again (currently sometime around the next millennium).


Regards


Dave