I think waiting to flatten until everything is done sounds reasonable. Just note that when using StringAdd the string won't be flattened until the first time it is used, whereas with the string builder the string is flattened when it is returned from concat. If your benchmarks doesn't use the string after creating it (say by reading the last character) the results are misleading since the cost won't include the flattening.
On the other hand if concat'ing 20 strings together and reading the last character is faster with a StringAdd based concat than a StringBuilder then I agree it's better to use StringAdd. http://codereview.chromium.org/243053 --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
