[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Userdata environment
- From: Mike Pall <mikelu-0804@...>
- Date: Tue, 1 Apr 2008 14:16:56 +0200
Roberto Ierusalimschy wrote:
> This is the result in my machine (N = 16). It seems quite stable...
>
> 18.9501953125
> 386.978515625
Yes, I thought so, too ... it works fine on Linux. But then I
tried it with the same version of Lua, compiled for Windows (with
either GCC or MSVC) and it grows without bound (and gets very
slow):
20.7646484375
31281.63671875
62531.44921875
93781.26171875
125031.29199219
156281.07421875
187531.10546875
...
LuaJIT 1.x has the same problem, except on all platforms (even in
interpreted mode). I've already narrowed this down to the size of
the TValue struct. It's 12 byte on Linux and BSD* (because doubles
are only 4 byte aligned in the SYSV i386 ABI), but 16 byte on
Windows (doubles are 8 byte aligned in the Windows x86 ABI).
You can force 8 byte alignment (i.e. 16 byte TValue) for Linux
with the following change to lobject.h, line 75 in Lua 5.1.3:
} __attribute__ ((aligned(8))) TValue;
Try it and you'll see, it grows without bounds now ...
My best guess is that the GC heuristics slow down the collector
too much if the size of the hash slots is 32 and not 28.
--Mike