[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PATCH: fixes bug with calling garbage collector from custom lua_Alloc
- From: "Bogdan Marinescu" <bogdan.marinescu@...>
- Date: Fri, 16 May 2008 09:48:54 +0300
Sadly, it will be a while until I'll get everything up&running on the
embedded platform, as I changed the CPU and a completely new port is
required. But I'll let you know as soon as I have some results.
On Thu, May 15, 2008 at 1:33 PM, Robert G. Jakabosky
<bobby@sharedrealm.com> wrote:
> Updated patch attached 'emergency_gc-5.1.3.patch'. Includes two memory
> optimizations, no new bugfixes in this release.
>
> The two memory optimizations are broken into two patches that can be used
> without the emergency gc patch. The emergency gc patch includes them. These
> two optimizations help to decrease the peak memory usages of scripts that use
> tables or work with a lot of unique strings. The most benefit will be to
> scripts that need to run with a limited amount of memory.
>
> Patch: 'stringtable_resize-5.1.3.patch'
> The Lua core has a global hashtable for internalized strings. As new strings
> are created that hashtable needs to grow and when strings are freed by the
> garbage collector that hashtable needs to be shrunk. The current resize
> method allocates a new hashtable and moves all the strings from the old
> hashtable to the new one, before it frees the old hashtable. This patch will
> do the resize without having to have two hashtables allocated at the same
> time by doing an in-place resize. This patch is simple compared to the next
> patch and it shouldn't increase cpu usage.
>
> Patch: 'hashpart_resize-5.1.3.patch'
> This patch makes a similar change to the way Lua tables are resized, but
> required a lot more work.
>
> Other attachments:
> stringtable_resize.lua - script used to test new resize method of internal
> string table.
>
> stringtable_resize.log - output of script for both old & new resize method. A
> debug message was added to the resize methods during the two runs. The peak
> memory usage for this script was about 4k lower for the new method.
>
> wordfreq.lua - script used for testing table resizing. A text file of the
> book "War and Peace" was used as input.
>
> wordfreq_peakmem_old_resize.log - output from wordfreq.lua using old resize
> method.
>
> wordfreq_peakmem_new_resize.log - output from wordfreq.lua using new resize
> method. Peak memory usage is about 400K lower then the old resize method.
>
> On Wednesday 14, Bogdan Marinescu wrote:
>> By the way, shouldn't your patch be published to
>> http://lua-users.org/wiki/LuaPowerPatches? I don't tknow if there are
>> any special requirements for a patch to be published on that page, but
>> I think this would make it more visible to the Lua community.
> I was going to add it to that page then I decided to wait until it was more
> stable(no outstanding bugs are features). I will add it after getting some
> feedback on the new changes.
>
>> On Tue, May 13, 2008 at 10:07 AM, Bogdan Marinescu
>>
>> <bogdan.marinescu@gmail.com> wrote:
>> > Once again, excellent work. I can't wait to test this on an embedded
>> > platform, but right now my ARM board is dead for some reason. I'll try
>> > with another board though.
> Thanks and let me know how it goes with running it on an embedded platform.
>
>
> --
> Robert G. Jakabosky
>