lua-users home
lua-l archive

Re: Memory usage stats for 5.2 vs 5.3

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


> [...] That said, a big +1 from me for removing those
> additional 4 bytes (from TString.hnext) in Lua 5.3 :)
I think we can do that following Tom's idea of storing the length of
short strings in a byte. Long strings are not hashed, so they do not
need the 'hnext' field. The struct could look like this:
typedef struct TString {
 CommonHeader;
 lu_byte extra; /* reserved words for short strings; "has hash" for longs */
 lu_byte shtlen; /* length for short strings */
 unsigned int hash;
 union {
 size_t len; /* length for long string */
 struct TString *hnext; /* linked list for hash (only for short strings) */
 } u;
} TString;
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /