Based on the documentation, mappings and dynamic arrays cannot be stored in between regular state variables, due to their unpredictable size.
So, they are assigned a 32 bytes slot in the place they are declared.
For arrays, the size of the array is placed in this slot.
For mapping, the slot stays empty but its position is needed to ensure if other mapping are placed one next to the other, their elements would be placed in different slots.
The storage is like an array where each slot is of 32 bytes (256 bits) and with a size of 2**256 (about 115792089237316195423570985008687907853269984665640564039457584007913129639936).
So, it's huge, you can fit a lot of 32 bytes data there.
So, to calculate where the element of an array will be put, the
keccak256 hash of the array index in the storage concatenated with the element index will be used. This will provide a 256 bit hash that will be the starting index of the array data in storage. Arrays can be optimized with their elements types. Check this article, in the "Reference Type storage layout" section.
For a mapping, the index of one of its elements is calculated with the
keccak256 hash of its key concatenated with the mapping index in the storage (the mapping index in storage is used to differentiate it from another mapping with exactly the same key/value type that may be placed close to it, since the
keccak256 hash will be totally different with this data).
So, coming back to your question, there is not much we can do to optimize a mapping. So don't worry too much about that.
A mapping can take as many elements as the storage size allows it to have.
Check the documentation for this concept: https://docs.soliditylang.org/en/v0.8.7/internals/layout_in_storage.html#mappings-and-dynamic-arrays