This patch reduces sizeof(PLDHashTable) as follows. - 64-bit: from 40 bytes to 32 - 32-bit: from 28 bytes to 20 It does this by doing the following. - It moves mGeneration from EntryStore to PLDHashTable, to avoid unnecessary padding on 64-bit. This requires tweaking EntryStore::Set() as explained in a comment. - It also shrinks mGeneration from uint32_t to uint16_t, saving 2 bytes of data. - It shrinks mEntrySize from uint32_t to uint8_t, to cut 3 bytes of data. - It shrinks mHashShift from int16_t to uint8_t, trimming another byte of data, and moves it, saving another 2 bytes of padding. And it reorders the fields so the word-sized ones are at the start, which makes it easier to imagine the memory layout. The patch also adds a test, and fixes some misordered function arguments in existing tests.
22 KiB
22 KiB