You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Joerg Henne <j....@levigo.de> on 2001/10/01 20:48:22 UTC

[C2] patch to serializers

Hi,

the Cocoon2 serializers for text, XML and HTML currently work very
inefficiently due to the fact that the underlying Xalan serializer writes
every character in a seperate call to the output stream's write() method. In
conjunction with a chunked transfer-encoding (the default for HTTP-1.1) this
leads to a 6-fold increase in the volume of data that hits the wire (it's
"1\r\n" plus the original character plus "\r\n" - just in case you wondered
:-).

The attached patch fixes the problem using a simple BufferedOutputStream. I've
placed the buffer creation into AbstractTextSerializer and removed buffer
creation code from AbstractSerializer. The buffer created in
AbstractSerializer was actually never used, because all subclasses of
AbstractSerializer either didn't use super.setOutputStream() or chose to
ingore AbstractSerializer's "output" field after calling
super.setOutputStream().
The fixed version works for me, but please review the patch carefully.

Joerg Henne