-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize IterKey #11153
base: main
Are you sure you want to change the base?
Optimize IterKey #11153
Conversation
8ac6c1f
to
66235f6
Compare
9d8fb86
to
45148ff
Compare
45148ff
to
9155169
Compare
705364e
to
e8d4698
Compare
Make inline buffer smaller by 3 bytes and remove the nano optimizations (3,4,5) will make the code much more maintainable. |
SSO is really a bit tricky, but it is localized to IterKey internal, and IterKey is used widely in rocksdb, so efficiency should be prefered.
|
IterKey
is essentially an SSO(short string optimization), it can be optimized more, in this PR:sizeof(IterKey)
is reduce from72
to64
and inline buffer size is increased from32
to48
key_size_
andbuf_size_
changed to uin32 because it is expected never larger than 2Gbuf_size_
is also used as a flag to identify inline buffer or outline bufferbuf_
ptr is folded to be shared withspace_
by usingunion
buf()
makes the intention clearis_user_key_
is changed to a bitfield which packed withbuf_size_
buf_size_
is accessed less frequent thankey_size_
, use bit field will not harm performance