-
Notifications
You must be signed in to change notification settings - Fork 418
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
Enhance ABI stability #1142
Comments
I have some concern with the PIMPL pattern being used extensively, due to complexity and performance. The complexity comes from just having so many more indirections within the code, especially in the case that you need to write a template method but access data via the impl class, which can cause some awkwards scenarios where you need to type erase data. The performance is just chasing pointers can be expensive if done everywhere. I'd like to consider the "fast PIMPL" pattern, which is a bit odd, but it can result in lots of performance improvements in certain cases: |
FastPIMPL looks good to me. There's also a lot of places where we can take advantage of an indirection we are already doing and have ABI stability for free. e.g.: std::shared_ptr<Publisher<MessageT>>
create_publisher(...)
...
class Publisher : public PublisherBase We are already returning a pointer to the object and never returning the object directly. With some slight modifications to the current API, we can provide ABI stability:
1 2 3 will make impossible for an user to hold a 4 ensures we don't break ABI stability because of inlined methods. This last rule is hard to follow correctly and needs careful reviewers ... We could also provide |
Those all seem like reasonable things to try. In general I'm in favor of going over the API and trying to find places to make use more future proof, but we should just be really thoughtful for each of them rather than blindly applying PIMPL everywhere. |
Yes I agree, I changed the title so the goal is clearer. |
Feature request
Feature description
We have run many times in the issue of not being able to backport a fix because it would break ABI.
e.g.:
Implementation considerations
We should evaluate where the effort matters and where it doesn't.
The text was updated successfully, but these errors were encountered: