Re: Performance analysis questions

Andrew Payne <>
Date: Sun, 15 May 1994 04:48:11 +0200
Message-id: <>
Precedence: bulk
From: Andrew Payne <>
To: Multiple recipients of list <>
Subject: Re: Performance analysis questions 
X-Listprocessor-Version: 6.0c -- ListProcessor by Anastasios Kotsikonas

George writes:

>>Code like this doesn't help (getline() in util.c):
>>           if((ret = read(f,&s[i],1)) <= 0) {
>This is done because it wants to hand off the file descriptor to
>CGI scripts that handle POSTs.  I'd suggest the right way to fix
>things is to read a bufferful and cat the extra to the scripts that
>need it.  

If the common case is GETs (which I suspect it is for most servers), doing 
buffered reads and just copying the bytes down to the POST script is 
probably the right thing do to.  Plus, POST data _tends_ to be short 

Actually, you can get the best of both methods.  Read the first 4 bytes of 
the connection.  If the method is POST, read the rest of the connection 
unbuffered and hand the socket off to the script.  Otherwise, do large 
block reads and buffer all you'd like.  If you seek the ultimate in 
performance, the extra code might be worth it.

Make the common case fast,