Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6498139
Votes 0
Synopsis Buffer allocations in SJSXP introduce large constant factors
Category jaxp:stax
Reported Against
Release Fixed 1.4, 6u2(b01) (Bug ID:2144541) , 7(b14) (Bug ID:2153496) , 6u14(b03) (Bug ID:2173471)
State 10-Fix Delivered, Verified, request for enhancement
Priority: 3-Medium
Related Bugs
Submit Date 28-NOV-2006
Description
Every time we encounter a new Entity (the document itself is treated as an entity), XMLEntityManager.startEntity method is called. This method in turn creates new instances of RewindableInputStream, Entity.ScannedEntity and a ???Reader (???=UTF8/ASCII/UCS etc.).

The RewindableInputStream wraps the InputStream in a buffer that can be rewound and re-read. The RewindableInputStream allocates a byte array of size DEFAULT_XMLDECL_BUFFER_SIZE = 64. ScannedEntity creates a new char array of either 8192 or 1024 bytes depending upon whether the entity is external or internal, respectively. The Reader (UTF8Reader is what I experimented with) creates a byte array, typically of same size as the ScannedEntity's char array (8192 for the document entity). Thus for every Entity, we allocate three buffers which can turn out to be relatively expensive operations, especially, if the documents are pretty small. One way to avoid these allocations are to use a buffer pool to allocate these buffers and return them when the parsing of entities are completed. The key issue is identifying when to release the buffers. 

Preliminary performance results indicate that 2-3X better performance is achievable on small messages (< 1KB) by implementing a better buffer allocation strategy.
Posted Date : 2006-11-28 18:21:56.0
Work Around
N/A
Evaluation
A new buffer allocation strategy has been implemented. The throughput for small messages (< 1KB) has doubled by significantly reducing GC time.
Posted Date : 2006-11-30 22:00:38.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang