-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Eliminate memory allocation from critical path: #4353
Conversation
(note: would like this to be tested on some full-history servers) |
(run on 2 full history servers in production; see if there is reduced memory usage) |
@manojsdoshi (I don't know Xun's git handle). Elliot is asking for this branch to be run on 2 full history servers and to compare memory usage before and after, please. |
I don't expect we'll see significant reduction in memory usage for this PR. It simply eschews the use of and While I'm confident that this is a net gain both in terms of memory usage (lower fragmentation) and perfromance (less work to do at runtime), the reality is that those gains are probably not directly measurable. Not saying you shouldn't run this to test; definitely do that. But I don't think the merging criterion should be whether there's observable reduction in memory usage. Tagging @mtrippled, @HowardHinnant for their thoughts. I do have an idea for something that could significantly reduce memory usage (to the tune of ~600MB) and (theoretically) improve performance. It's the same principle as the #4218, but for |
When writing objects to the NodeStore, we need to convert them from the in-memory format to the binary format used by the node store. The conversion is handled by the `EncodedBlob` class, which is only instantianted on the stack. Coupled with the fact that most objects are under 1024 bytes in size, this presents an opportunity to elide a memory allocation in a critical path. This commit also makes the interface of `EncodedBlob` simpler while also eliminating a subtle corner case that could result in dangling pointers.
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
@nbougalis if you feel this is ready to merge, please put the |
When writing objects to the NodeStore, we need to convert them from the in-memory format to the binary format used by the node store.
The conversion is handled by the
EncodedBlob
class, which is only instantianted on the stack. Coupled with the fact that most objects are under 1024 bytes in size, this presents an opportunity to elide a memory allocation in a critical path.This commit also makes the interface of
EncodedBlob
simpler while also eliminating a subtle corner case that could result in dangling pointers.High Level Overview of Change
Context of Change
Type of Change