Why is a byte card faster than a bit card?

I read the Garbage Collection Guide. He says that when you make a card table, they use a bytemap instead of a bitmap and say it is faster than a bitmap due to the high caching speed? But, as I know, the cache line is usually 64 bytes, if we make changes in the byte, the racing dispute still exists, another processor will invalidate the line anyway, it's the same as a bit card, can anyone to help?

+4
source share
1 answer

Not sure if I understood the context correctly, but overall:

  • bitmap access

    BYTE/WORD/..., / .

    , 8- , :

    BYTE map[];
    

    :

    readed_bit=(map[bit>>3]>>(bit&7))&1;
    

    :

    map[bit>>3]|=1<<(bit&7);
    

    :

    map[bit>>3]&=255^(1<<(bit&7));
    

    bit - , . , .

  • BYTE

    readed_byte=map[byte];
    

    :

    map[byte]=1;
    

    :

    map[byte]=0;
    

    byte - BYTE, . , , .

, HW, , BYTE ... , , , ...

0

Source: https://habr.com/ru/post/1694563/


All Articles