Anonymous
6/22/2025, 9:44:36 PM
No.105674007
>>105673954
How are abstract classes functionally different from traits in Rust?
>>105673958
They do, but similar data is still spead out far wider. Say you have some Unit object in some RTS game which has fields like
>position
>health
>orientation
>owner
>cooldown state of weapon
>current speed
And like many other things, these all take up space so the “owner” field of different units isn't as compactly laid out in memory as it could be. It turns out that in practice you mostly in code want to access similar data right after each other, so the more similar data can fit into the least memory right next to each other, the more cache hits you're going to get.
How are abstract classes functionally different from traits in Rust?
>>105673958
They do, but similar data is still spead out far wider. Say you have some Unit object in some RTS game which has fields like
>position
>health
>orientation
>owner
>cooldown state of weapon
>current speed
And like many other things, these all take up space so the “owner” field of different units isn't as compactly laid out in memory as it could be. It turns out that in practice you mostly in code want to access similar data right after each other, so the more similar data can fit into the least memory right next to each other, the more cache hits you're going to get.