lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks for the info.

Performance is one thing.

But all high-level languages *should* have proper dynamic strings.

If this were not true, than PIL would not need to mention the warning
in section 11.6.

Basically, all programmers expect that a = a .. b should be efficient.

Well I just joined this list to post my patch because it was useful to me
and my commercial product.

And to basically say: "look, one person spent a whole lot of time
implementing a patch instead of just complaining, so perhaps we
should fix this problem once and for all."

I'll be unsubscribing now.

Ciao

-paul


>
> I could be reading it wrong, but it looks to me like
> addString is there for illustration purposes, to show
> the algorithm used INTERNALLY be table.concat and a
> few other library functions.
>
>> local n = 1
>> local s = "hellothere"
>> while n < 50000 do
>>    s = string.append(s, "a")
>>    n = n + 1
>> end
>
> BTW: Lua has a numerical for loop, so you could have written that:
>
>    local s = "hellothere"
>    for n=1,50000 do
>       s = string.append(s, "a")
>    end
>
> Have you compared it's performance with:
>
>    local buf = { "hellothere" }
>    for n=2,50000 do
>       buf[n] = "a"
>    end
>    local s = table.concat(buf)
>
> Cheers,
> Eric
>