Boxing
От: snaphold  
Дата: 24.05.17 04:37
Оценка:
Читаю книжку и непонятен такой вот кусок
Речь идёт про вставку в arraylist byte.
Думал будет на каждый байт оверхед в 4 байта — указатель на объект в который забоксится byte
Почему 16 байт оверхеда будет на каждый байт?
По ходу с англ не очень у меня

The difference in efficiency here is incredible. Let’s look at the ArrayList first, con-
sidering a 32-bit CLR.7 Each of the boxed bytes will take up 8 bytes of object overhead
plus 4 bytes (1 byte, rounded up to a word boundary) for the data itself. On top of that,
you have all the references themselves, each of which takes up 4 bytes. So for each byte
of useful data, you’re paying at least 16 bytes—and then there’s the extra unused space
for references in the buffer



 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.