[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Hybird GC issues in lua 5.4
- From: 云风 Cloud Wu <cloudwu@...>
- Date: Wed, 23 Dec 2020 11:08:42 +0800
Hugo Musso Gualandi <email@example.com> 于2020年12月23日周三 上午4:21写道：
> > I think using a pointer to hold the string data would be better then
> > putting the data into a continuous TString structure.
> One advantage of putting the string data in a contiguous structure is that it avoids having to go through an additional layer of pointer indirection to read the string contents.
> But to be honest, I don't know how much that matters in practice. That's an interesting question.
In my opinion, the string object in lua VM core is only a reference.
We seldom use long-string as a key of the table,
and to the short-string key, lua doesn't need to read the string
contents. It only compares the pointers of TString.
A smaller GCObject is more (cache) friendly to the collector because
it always traverses the objects.