At some point, the divide and conquer approach has so much overhead that the simple solutions are better. fork() is especially expensive, as once you get a few processes out there, context switching between them will take more time than plodding along in a for loop (which will probably optimize to a handful of machine code expressions anyway).
I really like the xor solution someone else pointed out, and you could probably do the 'x characters at a time' on it, too. | [reply] |
We also considered splitting it up. We couldn't reason
out the interprocess communication properly. In actual
use, this algorithm get's run every time we insert a new
string. So we couldn't figure out how to reliably make
sure the kids were all working on mdifferent strings--I mean,
we coulda ... we just thought it was a dead end.
Unless there _a lot_ of kids (on lotsa computers), it just
didn't sound useful.
| [reply] |