-
Notifications
You must be signed in to change notification settings - Fork 851
Make Allocator.h less silly (no creepy "proto" object). #6153
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
Conversation
2f5f2ea to
9891d8c
Compare
|
One of the main points of the class proxy allocator is to use the "proto" object to have better construction performance because a constructor is unlikely to be faster than a |
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.
As @SolidWallOfCode talk about, You need cleanup all init function before this pr.
|
We've talked about doing these in-place new() (or whatever the C++ nerds calls it). I'm generally ok with rolling forward into modern C++, but, we should definitely
I imagine if all classes had member initializers in the tor's (and no init), this in-place new() would be roughly the same as our memcpy ? But how expensive are those Init()'s ? |
|
I don't remember the detail, but I faced an issue with init() 1-2 years ago. A std::vector in a class (a member variable) was not initialized. There might be a better way but I think I stopped using alloc-and-init for the class or used placement new after alloc. |
|
Yes, it's definitely a problem to use this with any STL container class ( I suspect that modern compilers, along with direct member initialization and placement new, would make the performance difference negligible and the code much cleaner. It's a big change, however, and we'll probably want to do it incrementally per allocated class, rather than in one big change. |
|
@SolidWallOfCode So what's the step forward here? Fix classes first, and then do this patch? This is definitely not for v9.x ;). |
|
Hmm I think it's far from clear that the proto object leads to overall better performance in ATS. For a class like this: I would bet it would. For: it might be faster if the proto object were in L1 cache, otherwise probably not. And for: direct construction corresponds to no object code. |
|
@scw00 the behavior of the current code should be the same without moving init() code into the constructor. Why do you say it needs to be done all in one step? |
|
@zwoop it already uses placement new, but it's currently only used to make the proto object. I don't know why. It's risky that there's no alignas(C) in front of typeObject. I think we can't know the thinking behind this code now that warpships from the The Planet Inktomi have stopped visiting Earth. |
|
I feel like we're a bit random about when we want to block stuff without performance testing. Ideally, a performance regression test would be done on every PR or at least nightly. |
|
Sorry for bother you . I'm fine with this pr, and I'm bother with this case too. My only concern is performance. IIUC, the original code using ats containers. And it works fine with empty constructor (constructor without args). So we are using one static object and initialize it, then copy it to every new one. The problem is we can not pass args. This is why we have So, now you want to remove this performance trick. It would be better to give a convinced evidence to explain which way is best. Finally, I'd love to approve this pr. So show us how much performance we gain or lost. |
|
@ywkaras have you been able to run the autests with this PR locally ? |
|
Yes in my build/test environment they all worked. I have to put this aside for a bit I'm working on an xdebug problem we're seeing. I doubt I can satisfy the perf concerns until we have some automated perf tests using traffic replay. |
|
[approve ci autest] |
2 similar comments
|
[approve ci autest] |
|
[approve ci autest] |
9891d8c to
ca8e19d
Compare
|
[approve ci autest] |
|
[approve ci autest] |
No description provided.