The only appendText function I found was on a TextField object. I need
something for Strings. I tried the string.concat method and got the
following for the following tests:

test1: 500ms
test2: 2200ms
private function test1():void {
                        var i:int = -1;
                        var s:String = ""
                        var app:String = "append";
                        var time:int = getTimer();
                        while(++i < 1000000) {
                                s += "A";
                        }
                        val1 = getTimer() - time;
                        callLater(test2);
                        
                }
                private function test2():void {
                        var i:int = -1;
                        var s:String = ""
                        var app:String = "append";
                        var time:int = getTimer();
                        while(++i < 1000000) {
                                s.concat("A");
                        }
                
                        val2 = getTimer() - time;                       
                        callLater(showResult);
                }

--- In [email protected], Simon Bailey <[EMAIL PROTECTED]> wrote:
>
> Try the much faster appendText() method :)
> 
> Cheers,
> 
> Simon
> 
> On 11 Jul 2008, at 13:53, polestar11 wrote:
> 
> Hi there
> 
> I wanted to check if there are any tricks one can do to improve the
> speed on concatenating strings.
> 
> I know in Java there is a StringBuilder class which is faster than the
> '+' operator. I havent seen an equivallent for Actionscript, so is var
> mystring:String = 'string1' + 'string2' the fastest way to concatenate
> strings?
> 
> CHeers
> tracy
>


Reply via email to