-
Notifications
You must be signed in to change notification settings - Fork 12
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
Empty base optimization for m_popper #23
Comments
IMO, since C++20 introduces I agree that if |
Doing it that way would make the C++20 version ABI-incompatible with the C++17 version --- doing it with EBO would work in all versions of C++. |
Thanks for this interesting input... makes me think of |
…Quuxplusone) - Add C++20 attribute [[no_unique_address]] - Add configuration macro nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS. vBox|Manjaro: - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 40 - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 Windows 10: - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 20 - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 16
…Quuxplusone) - Add C++20 attribute [[no_unique_address]] - Add configuration macro nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS. vBox|Manjaro: - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 40 - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 Windows 10: - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 20 - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 16
Comment on commit by @dcolascione:
The origin for flag Although that proposal appears to not be actively pursued at the moment, I'm somewhat hesitant to deviate from that path right now. I prefer to allow some time and possibly gather some (more) feedback to base my decisions on. |
…Quuxplusone) - Add C++20 attribute [[no_unique_address]] - Add configuration macro nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS. vBox|Manjaro: - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 40 - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 Windows 10: - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 20 - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 16
…xplusone) Add macros nsrs_HAVE_NO_UNIQUE_ADDRESS and nsrs_NO_UNIQUE_ADDRESS
…Quuxplusone) - Add C++20 attribute [[no_unique_address]] - Add configuration macro nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS. vBox|Manjaro: - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 40 - gcc (GCC) 11.1.0, -std=C++17, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 32 - gcc (GCC) 11.1.0, -std=C++20, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 32 Windows 10: - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=0: sizeof(ring_span): 20 - MSVC 19.28 (VS2019), -std:c++latest, nsrs_CONFIG_POPPER_EMPTY_BASE_CLASS=1: sizeof(ring_span): 16
Addressed in Release 0.6.0. |
Right now, popper is a field, m_popper. We store a byte for m_popper even though the popper is usually stateless. If the popper were instead a base class, there would be no size penalty in the case that m_popper has no state.
The text was updated successfully, but these errors were encountered: