Here's forward.c, much simpler and very straightforward:
while( more targets to go )
{
parse to see what command to run
open a pipe to the command
send the header to the pipe
send remaining lines from the database to the pipe
close the pipe
next target
}
It might look like I only picked a different bottleneck than before (here
it's the database, before it was the number of open pipes) but actually
this algorithm is just the database version as before, but with the pipe
openings happening once for each loop rather than all at once and stored
to a list, then going through the list and sending on all the pipes. My
goal was the eliminate the "start everything all at once" resource hog.
The only consumer of forward.c was pipe.c, so there was no trouble paring
it to the bone to match up with the pared down pipe.c. Note that the
function definition has changed. The new pipe.c I posted does not reflect
this change yet, but it's all alpha 1 anyways... I haven't tested
anything, although it looks correct and compiles cleanly ;-)
Aaron
while( more targets to go )
{
parse to see what command to run
open a pipe to the command
send the header to the pipe
send remaining lines from the database to the pipe
close the pipe
next target
}
It might look like I only picked a different bottleneck than before (here
it's the database, before it was the number of open pipes) but actually
this algorithm is just the database version as before, but with the pipe
openings happening once for each loop rather than all at once and stored
to a list, then going through the list and sending on all the pipes. My
goal was the eliminate the "start everything all at once" resource hog.
The only consumer of forward.c was pipe.c, so there was no trouble paring
it to the bone to match up with the pared down pipe.c. Note that the
function definition has changed. The new pipe.c I posted does not reflect
this change yet, but it's all alpha 1 anyways... I haven't tested
anything, although it looks correct and compiles cleanly ;-)
Aaron