-
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
Improve performance of SliceTransform::AsString #9401
Conversation
1. Removed the options from the Capped/Fixed SliceTransforms. Instead these classes are created with id.number. This allows the GetID() id to be calculated and stored at class construction time 2. Improve the performance of AsString by using the ID only if there are no option properties (which is the case for all of the builtin transforms). Ran tests of calling AsString in a loop 5M times and found approximately a 10x performance increase vs the original code.
@mrambacher has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
By making the function virtual and requiring implementations with options to override it, performance improves to close to parity with prior implementations.
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
Summary: A proposed alternate fix to performance regression associated with SliceTransform::AsString, vs. facebook#9401 Test Plan: performance testing TODO
include/rocksdb/slice_transform.h
Outdated
// and any additional properties. | ||
// The default implementation is optimized for instances which have no | ||
// additional properties/options. Instances which have properties/options | ||
// should override this method and call ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to involve the API extension user in performance concerns in non-obvious ways.
(See #9407)
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@mrambacher has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@mrambacher This seems to have broken the LITE build; could you please take a look? |
Removed the options from the Capped/Fixed SliceTransforms. Instead these classes are created with id.number. This allows the GetID() id to be calculated and stored at class construction time. This change puts the construction back to similar to how it was prior to the Customizable changes for SliceTransform.
Improve the performance of AsString by using the ID only if there are no option properties (which is the case for all of the builtin transforms).
Ran tests of calling AsString in a loop 5M times and found approximately a 10x performance increase vs the original code.