|
On May 6, 2014 5:36 PM, "Philipp Janda" <siffiejoe@gmx.net> wrote:
>
> Am 06.05.2014 22:21 schröbte Roberto Ierusalimschy:
>
>>> A very minor thing, but putting `hash` before `len` and `hnext` in
>>> the definition of `TString` saves 8 bytes per string on my machine
>>> where `sizeof( size_t) == 8` and `sizeof( unsigned int ) == 4`
>>> (Linux x86_64). This should be safe for all architectures where
>>> `sizeof( size_t ) >= sizeof( unsigned int )`, and I don't know if
>>> there are machines out there where this isn't true ...
>>
>>
>> Many thanks. (I believe the same is true about field 'sizearray' in
>> 'struct Table'.)
>
>
> Confirmed: 56 bytes instead of 64 when `sizearray` is above `metatable`. This also works for Lua 5.2, btw.
Any effects on performance? The cache hierarchy and prefetch/speculation etc have often surprised me.