4 ms·
Thank you, I misread this from the article as saying 64 bit cache lines: "(assuming 32 bit pointers and 64 byte cache lines)" So: byte otherMembers[64]; is 5
by eliasmacpherson 13y ago
Thank you, I misread this from the article as saying 64 bit cache lines:
"(assuming 32 bit pointers and 64 byte cache lines)"
So:
byte otherMembers[64];
is 512bits of addresses to other members, that will hold 16 32bit addresses.
From the article: "In the case of an array with pointers there may still be a cache miss when reading the ‘valid’
flag but there will be at most one additional
cache miss every 16 pointers"
so idList must use operator[] to sensibly iterate over otherMembers.
class idMyClass {
bool valid;
byte otherMembers[64]; // over a cache line worth of other members
};
idList< idMyClass * > myObjects;
for ( int i = 0; i < myObjects.Num(); i++ ) {
if (myObjects[i]>valid ) {
}
}