lua-users home
lua-l archive

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

on 9/13/04 5:00 PM, Jamie Webb at wrote:

> On Mon, Sep 13, 2004 at 08:41:36AM -0700, Mark Hamburg wrote:
>> Have any performance tests ever been done on storing string data and
>> userdata in separate memory blocks from the headers? The benefit of doing so
>> would be faster GC time since pointer-free memory wouldn't need to be
>> accessed.
> Are you sure? Unlike something like the Boehm collector, Lua never
> needs to scan through raw data to find pointers; it knows where they
> all are.

The GC would avoid cache loads, TLB misses, and page faults to bring in data
without pointers because the relevant data for the GC would be more compact.

>> This would also make it possible to create userdata objects that managed
>> pointers they didn't allocate and shouldn't free except via the __gc
>> metamethod.
> How would that be different to storing a pointer in the userdata?

You are correct that it would be identical to what we have right now. I
guess I was thinking about it being conceptually different from the
standpoint that the Lua managed block would always hold a pointer with the
option of having that pointer freed by Lua.