mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
![Nicholas Nethercote](/assets/img/avatar_default.png)
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. --HG-- extra : rebase_source : 6ed6f7be68477fd4a82f07dd2f51c1f1d9b92dcc