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

Key: JANINO-76
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Arno Unkrig
Reporter: Tom Gibara
Votes: 0
Watchers: 0
Operations

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

Suboptimal compilation strategy for the string concatenation operator.

Created: 02/Feb/07 02:12 PM   Updated: 15/Feb/07 02:06 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Any


 Description  « Hide
Janino currently uses repeated calls to the String.concat() method to implement the concatenation of strings using the + operator. While this is certainly optimal in the case of two operands, larger numbers of operands result in degraded performance (due to the resulting quadratic complexity). Though Janino performs a 'constant folding' optimization that resolves this in many/most instances, the performance of non-constant concatenation is still a problem.

A test case can be dowloaded from:
http://www.tomgibara.com/janino-evaluation

A preliminary benchmark comparing the performance of concat() to StringBuffers and StringBuilders in Java 1.5 and Java 6 might be useful and is available at:
http://www.tomgibara.com/janino-evaluation/string-concatenation-benchmark

Note this behaviour has been observed in Janino versions 2.5.1 - 2.5.3 inclusive, but is probably present in all versions.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Arno Unkrig - 15/Feb/07 02:06 PM
Fixed in 2.5.5.