[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Alternative string concat (was "out of memory ")
- From: Enrico Colombini <erix@...>
- Date: Tue, 08 Oct 2002 09:36:46 +0200
>The string .. operation is not slow in Lua. It's actually very fast, even
>for multiple concatenations. The virtual machine operation is actually for
>multiple concatenation. Here is the code for
> return "a" .."b" .."c" .."d"
>
> 1 [2] LOADK 0 0 ; "a"
> 2 [2] LOADK 1 1 ; "b"
> 3 [2] LOADK 2 2 ; "c"
> 4 [2] LOADK 3 3 ; "d"
> 5 [2] CONCAT 0 0 3
>
>So, this is a linear (not quadratic) operation.
>Bottom line: there's no reason not to use multiple concatenations for long
>strings. (Except that there is a limit on the number of concatenations.)
Very interesting. It seems I tried to solve a non-problem :-)
What is the limit?
Thanks to all for the information, suggestions... and patience.
Enrico