We found a small performance discrepancy between Java's
HttpURLConnection and HttpClient. Disabling stale connection checks
helps but HttpURLConnection is still faster for small payloads. Making
the following change to HttpConnection.java (line 689 in version 2.0.1)
speeds things up considerably:

   inputStream = new BufferedInputStream(socket.getInputStream());

The BufferedInputStream's mark/reset methods can be used in place of
PushbackInputStream.unread, e.g.:

    this.socket.setSoTimeout(timeout);
    inputStream.mark(1);
    int byteRead = inputStream.read();
    if (byteRead != -1) {
       inputStream.reset();
       LOG.debug("Input data available");
       result = true;
    } else {
       LOG.debug("Input data not available");
    }

Thanks,
Bjarne.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to