lua-users home
lua-l archive

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


On Wed, May 28, 2008 at 1:49 AM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>>   <some-prefix><size><data1><data2>...<dataN><suffix>

>> The question is, is it possible, at least at "implementation-specific"
>> level to insert the number of elements after I have added all the data
>> to buffer?

> Push the prefix and nil and then open a buffer for the data. At the end,
> close the buffer, lua_replace the nil with the size and concat the 3 strings.

If I get it correctly, this would be at least two concat calls per
nesting level of data (each nesting level would have own prefix and
size written).

That is, for

  root
    -branch
    -branch

I would have minimum 6 concat calls (counting concats done by buffer
facilities internally).

I'd like to minimize number of concats for performance reasons.

Thank you,
Alexander.