You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Michael Glavassevich (JIRA)" <xa...@xml.apache.org> on 2007/02/17 22:29:05 UTC
[jira] Created: (XALANJ-2368) Performance: UTF-8 writer byte[] and
char[] buffers should be reused
Performance: UTF-8 writer byte[] and char[] buffers should be reused
--------------------------------------------------------------------
Key: XALANJ-2368
URL: https://issues.apache.org/jira/browse/XALANJ-2368
Project: XalanJ2
Issue Type: Bug
Components: Serialization
Affects Versions: The Latest Development Code
Reporter: Michael Glavassevich
Every time a UTF-8 encoded document is serialized, a new instance of WriterToUTF8Buffered is created which in turn creates a 16 KB byte buffer and a 10 KB char buffer. When the serializer is used to serialize small (around 1 KB) documents the overhead of creating and garbage collecting these buffers is extremely large. Reusing the buffers would significantly improve the performance.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2368) Performance: UTF-8 writer byte[]
and char[] buffers should be reused
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XALANJ-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474823 ]
Brian Minchau commented on XALANJ-2368:
---------------------------------------
A serializer creates a new WriterToUTF8Buffered object each time an OutputStream is set,
and this object has the buffers that Michael refers to.
The simplest fix is to re-use a WriterToUTF8Buffered object rather than have the caller
own the buffers. One would add a setOutputStream(OutputStream os) method to
WriterToUTF8Buffered, and when called the method would not only set the output stream but also set the internal "count" to zero.
This means that the OutputStream held by a WriterToUTF8Buffered object no longer has a "final" reference, but this isn't so bad as that object is written to very infrequently, only once the internal buffer is full of characters is full, or at the end when the writer is flushed. This leaves the WriterToUTF8Buffered object in full control of its internal ugly buffers.
I'll be attaching a patch soon.
> Performance: UTF-8 writer byte[] and char[] buffers should be reused
> --------------------------------------------------------------------
>
> Key: XALANJ-2368
> URL: https://issues.apache.org/jira/browse/XALANJ-2368
> Project: XalanJ2
> Issue Type: Bug
> Components: Serialization
> Affects Versions: The Latest Development Code
> Reporter: Michael Glavassevich
> Attachments: SerializePerfTest.java, utf8-writer-patch.txt
>
>
> Every time a UTF-8 encoded document is serialized, a new instance of WriterToUTF8Buffered is created which in turn creates a 16 KB byte buffer and a 10 KB char buffer. When the serializer is used to serialize small (around 1 KB) documents the overhead of creating and garbage collecting these buffers is extremely large. Reusing the buffers would significantly improve the performance.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org