[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: stackoverflow with LuaJIT 2.0.0-beta6 (but not with lua 5.1.4)
- From: Geoff Leyland <geoff_leyland@...>
- Date: Thu, 21 Apr 2011 10:56:10 +1200
On 21/04/2011, at 9:39 AM, Valerio Schiavoni wrote:
> Hello Geoff,
>
> On Wed, Apr 20, 2011 at 11:32 PM, Geoff Leyland
> <geoff_leyland@fastmail.fm> wrote:
>
>> It looks like most of the time is spent concatenating strings on the lines
>> out = out..encode(v)
>> and
>> return out..'e'
>>
>> Have you tried making 'out' a table, appending strings to it and then doing a table.concat as you return it?
>
> i tried that as the first thing, and the optimization gain was unnoticeable.
How about having encode do this:
function encode(data)
local out = { n=1}
encode_table(data, out)
return table.concat(out)
end
and encode_data contains lines like:
encode_table(v, out)
rather than
out = out..encode(v)
Cheers,
Geoff