PragmaTwice commented on PR #2142: URL: https://github.com/apache/kvrocks/pull/2142#issuecomment-1987035593
> The number of consecutive 0s is calculated from the last 50 digits of the hash value, so the maximum value is 50, and the maximum value stored in a string is 2 bytes. It should not waste a lot of space, and at the same time save the overhead of integer encoding and decoding. For keys, it may be more efficient, but the largest index is only 5 bytes (16383). Sorry but I cannot get your point. In every sense, using a string representation cannot be more efficient. In binary representation: if the maximum value is less than 2^8, you should use one byte; and if the maximum value is less than 2^16, you should use two bytes. > Not really. The register(subkey) only be stored which its count is not zero. This point is different from the memory implementation with static array as dense encode. On disk, I think its sparse encode naturally. I don't think you answered my question. The maximum number of subkeys is still 2^16. I think multiple registers should be put into one subkey to reduce the number of keys and improve the efficiency of count. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
