Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Any
-
Number of attachments :
Description
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.
Fixed in 2.5.5.