in reply to Re: pipes and return data
in thread pipes and return data

Please, if you are going to post a benchmark and results, do so responsibly. The code you posted has (at least) two errors:

timethese( 100], {

Where'd that spurious ']' come from? I realize this was probably a cut-n-paste error, but still...

open PROG, ">/dev/nul";

This one is more serious. It implies that you tested printing your strings to a non-existent file handle. Ooops.

Benchmark: timing 100 iterations of join, local, manual...

Wait... what about 'html'? So, I guess you ran that later and added it into your results?

I probably would have missed all of this had I not been suspicious of your results. I would have guessed the 'html' version to be the fastest by far... so I had to check for myself. Here are the results I got, after correcting the errors noted above:

Benchmark: timing 100 iterations of html, join, local, manual... html: 46 wallclock secs (45.58 usr + 0.05 sys = 45.63 CPU) @ 2 +.19/s (n=100) join: 220 wallclock secs (219.65 usr + 0.07 sys = 219.72 CPU) @ + 0.46/s (n=100) local: 221 wallclock secs (220.61 usr + 0.14 sys = 220.75 CPU) @ + 0.45/s (n=100) manual: 866 wallclock secs (864.92 usr + 0.26 sys = 865.18 CPU) @ + 0.12/s (n=100)
For completeness:
$ prtdiag | head -3 System Configuration: Sun Microsystems sun4u 4-slot Sun Enterprise 3 +000 System clock frequency: 84 MHz Memory size: 1024Mb
To double check those findings, I ran it on a PC as well:
Benchmark: timing 100 iterations of html, join, local, manual... html: 7 wallclock secs ( 6.36 usr + 0.01 sys = 6.37 CPU) @ 15 +.70/s (n=100) join: 22 wallclock secs (22.27 usr + 0.01 sys = 22.28 CPU) @ 4 +.49/s (n=100) local: 22 wallclock secs (22.46 usr + 0.02 sys = 22.48 CPU) @ 4 +.45/s (n=100) manual: 76 wallclock secs (75.38 usr + 0.01 sys = 75.39 CPU) @ 1 +.33/s (n=100)
And, again, for completeness here is some system info:
Linux 2.4.18-14 model name : Intel(R) Pentium(R) 4 CPU 2.40GHz stepping : 4 cpu MHz : 2405.502 cache size : 512 KB MemTotal: 513908 kB MemFree: 388036 kB

Frankly, I still don't know how you managed to get such poor figures for the 'html' code.

-sauoq
"My two cents aren't worth a dime.";