in reply to Re(2): some forking help
in thread some forking help

The only way in which a fork()ing solution would be faster than the solutions posted so far, would be in a MP machine, where each process could scan the file separatedly. This, assuming that the file fits within the buffer cache.

Otherwise, the price of the context switches will make this solution run slower.

Just my $0.02 :)

Merry Christmas to all the fellow monks!

Replies are listed 'Best First'.
Re(4): some forking help
by dmmiller2k (Chaplain) on Dec 25, 2001 at 01:13 UTC

    I'm not sure. My gut feeling is that searching a file is fairly I/O bound, and therefore would involve a significant amount of waiting for the disk regardless; why not capitalize on that by waiting in parallel?

    dmm

    You can give a man a fish and feed him for a day ...
    Or, you can
    teach him to fish and feed him for a lifetime