Poor performance in IE due to bad string concatenation

Description

In IE 5, 6 and 7, when passing up large javascript objects to the server, it takes ages to finish (I am speaking about more than 5 minutes here) whereas it is very fast in FireFox (a few seconds).
This problem was raised a year ago in the following thread : http://www.nabble.com/Poor-client-side-performance-in-engine.js-to8310543.html#a8310543

As exposed in this thread, the problem comes from the way the query string is built :
query += prop + "=" + batch.map[prop] + "\n";

The "+=" construct is terribly slow in IE, and it would be better to use directly an array or a javascript implementation of a StringBuffer.

Activity

Show:
Mike Wilson
April 8, 2008, 1:53 PM

Unfortunately it's not as simple as just using array.join everywhere. For the type of string building we do, string+= is actually faster than array joining in all browsers except IE, but in IE it makes a huge difference.

Even in IE it is faster to use string+ for building small strings than to use an array.

So the fix I have checked in uses array.join in IE only, and only for areas in the code where large strings are handled. This has put IE performance on par with FF performance (a little bit slower though).

Assignee

Mike Wilson

Reporter

BarthélémyH

Labels

None

Documentation Required

None

Components

Fix versions

Affects versions

Priority

Major
Configure