History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-506
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Joerg Schaible
Reporter: Stefan Wappler
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

Method com.thoughtworks.xstream.mapper.FieldAliasMapper.key(Class,String) contains performance hotspot

Created: 09/Jul/08 12:43 PM   Updated: 09/Jul/08 12:43 PM
Component/s: Core
Affects Version/s: 1.2.2, 1.3
Fix Version/s: None

JDK version and platform: Sun 1.5.0_12 for Windows


 Description  « Hide
The profiling results for our application (which uses XStream 1.2.2 / 1.3) suggest that the keying mechanism used by the field alias mapper leads to a performance hotspot (in terms of execution time) due to the combination of the two factors number of invocations (the key method is called relatively often during serialization), and costs (in terms of execution time) per invocation, caused by the expensive string operations (implicit use of java.lang.StringBuffer – init, append, toString in the key method).

I recommend reworking the key mechanism so as to avoid using string operations. Maybe using the parameter object references as a key instead of concatenating their string representations could be a more efficient approach?

The number of calls to the key method could also be reduced in some instances, e.g. method shouldSerializeMember(Class definedIn, String fieldName) could first check whether fieldsToOmit is empty before constructing the key with which to search the hashset.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.