lua-users home
lua-l archive

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


>>>>> ">" == 重归混沌  <findstrx@gmail.com> writes:

 >> I test four size of 'tt_' with each struct assign method, the result
 >> is amazing.

 >> #define setobj_X(L,obj1,obj2) \
 >>   { TValue *io1=(obj1); *io1 = *(obj2); \
 >>          (void)L; checkliveness(L,io1); }

 >> #define setobj_Y(L,obj1,obj2) \
 >>   { TValue *io1=(obj1); const TValue *io2=(obj2); \
 >>       io1-> value_ = io2->value_; io1->tt_ = io2->tt_; \
 >>      (void)L; checkliveness(L,io1); }

How did you test this? because undoing this change breaks table
handling, since NodeKey aliases TValue in a way that isn't (as far as I
know) strictly kosher. (I get "table index is nil" errors from trying
it)

 >> Because the sizeof(TValue) is 16 bytes on 64 bit platform, but
 >> sizeof(obj->value_) + sizeof(obj->tt_) is 9 bytes.

There should be no performance difference between copying 9 and 16
bytes.

-- 
Andrew.