UIZE JavaScript Framework

PERFORMANCE TEST: String Concatenation Approaches

This test page demonstrates that constructing a large string using either the "+" operator or populating an array and then using the join native method can take vastly different amounts of time, depending on the browser used. In Internet Explorer, using the "+" operator slows down dramatically as the string grows in size, whereas in Firefox there is virtually no difference in performance between the two techniques.

In the test, a large string is built by iteratring 10000 times, each time adding a string chunk of 70 characters in length, giving a total built string length of 700,000 characters. The results of this test clearly indicate that there is a compelling argument in favor of the string join approach when building large string content iteratively, such as programmatically constructing large chunks of HTML markup or serializing internal data objects as XML or JSON text for consumption by services and the like.