Re:Writing a Very Fast Hash Table with Tiny Memory Footprints
by jsnell on Tuesday May 09, 2017 @11:25AM
(#14300799)
> I guess things are not packed further to allow to just directly use the pointer instead of having to do some computation for each access.
There are C++ standard libraries that pack things further. I think clang has a 24 byte std::string, which can store strings of up to 22 bytes inline.
Strings smaller than 16 bytes are stored in the 16 bytes inline buffer, which means strings larger than that actually take 32 + their length + 1 bytes in memory on 64-bits platforms.
I guess things are not packed further to allow to just directly use the pointer instead of having to do some computation for each access.