-
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
Q2 2021 priorities #1800
Comments
Does it mean that after 16.10 is released the C++20 STL ABI will be frozen for, at the very least, until vNext is out? |
So will "format" be ported to VS 2019? That would be great, I thought "format" and "chrono" will be landed in Dev17(VS 2021?)... |
That's correct, C++20 will join C++14/17 in being ABI-frozen until vNext. (This coincides with the addition of the We'll still be able to fix things in ways that preserve ABI, but we won't be able to change layout (as we did with
Yep! We're trying to finish it in time to be ported to VS 2019 16.10 Preview 3. (There will also be a VS 2019 16.11 but we really don't want the features to slip into that release.) |
Thank you. For example, the |
Also I'm afraid P2216 might cause complications since it involves ABI changes and WG21 seems to want to retroactively apply it to C++20. |
@jovibor We'll have a brief window (basically 16.10 Preview 4) where we can make ABI-breaking performance improvements. If you want to help, you can investigate The main thing to look at first would be any persistent data structures (those that live longer than a function call) because their representations will be frozen. We can arbitrarily modify functions (if they're header-only), including data structures that remain entirely within those functions, but anything that can be mixed-and-matched across TUs is subject to ABI considerations (which is why regex is such a headache, but charconv is not in that way). I would love to have additional time for the ABI to be "unlocked" (and I want a 🐴 and a 🦄), but this decision is from our bosses and boss-like entities - when we add
Yeah, we're aware of this. We don't want to implementer-veto anything but we will if we have no other choice. (An implementer veto is when the Standard tells us to do something that's impossible, so we just don't do it - as happened with |
But isn't the At least I can compile it (by copy-paste) and it seems to work as expected. |
It's header-only, but there's a difference between this: inline int compute_something(int x, int y) {
// Arbitrarily complicated computation involving x and y.
// This implementation can be changed without breaking ABI.
} And this: struct Span {
int * ptr;
size_t len;
// This is also header-only, but reordering ptr and len would break ABI.
}; To determine whether a change could break ABI, one has to reason about what happens when an old object file (built with the old implementation) and a new object file (built with the new implementation) are mixed together. It's okay for them to have different implementations of |
That's understood. I just didn't know that STL is so careful about object files compatibility, my naive assumption was that this is only for .dll boundaries.
So, below are some of my rough test results. #include <iostream>
#include <chrono>
#include "format" //copy-pasted from https://github.com/microsoft/STL/blob/feature/format/stl/inc/format
#define FMT_HEADER_ONLY
#include "fmt/format.h" //https://github.com/fmtlib/fmt copy of the current master branch.
int main()
{
const auto tSTDStart = std::chrono::high_resolution_clock::now();
for (auto i = 0; i < 1'000'000; ++i) //STD test loop.
const auto wstrSTD = std::format(L"std::format {}\n", 42);
const auto tSTDEnd = std::chrono::high_resolution_clock::now();
const auto tFMTStart = std::chrono::high_resolution_clock::now();
for (auto i = 0; i < 1'000'000; ++i) //FMT test loop.
const auto wstrFMT = fmt::format(L"fmt::format {}\n", 42);
const auto tFMTEnd = std::chrono::high_resolution_clock::now();
const auto durationSTD = std::chrono::duration_cast<std::chrono::microseconds>(tSTDEnd - tSTDStart).count();
const auto durationFMT = std::chrono::duration_cast<std::chrono::microseconds>(tFMTEnd - tFMTStart).count();
const auto wstrResult = std::format(L"STD duration: {}\nFMT duration: {}\nRatio is (std/fmt): {:.2f}\n",
durationSTD, durationFMT, static_cast<double>(durationSTD) / static_cast<double>(durationFMT));
std::wcout << wstrResult << std::endl;
return 0;
} The output is:
I ran this simple program many times and the ratio was almost always somewhere in-between 1.20-1.25 (rare times 1.3). |
If the test is just a bit more complicated then the ratio is even worse for #include <iostream>
#include <chrono>
#include "format" //copy-pasted from https://github.com/microsoft/STL/blob/feature/format/stl/inc/format
#define FMT_HEADER_ONLY
#include "fmt/format.h" //https://github.com/fmtlib/fmt copy of the current master branch.
int main()
{
const auto tSTDStart = std::chrono::high_resolution_clock::now();
size_t sum1 { };
for (auto i = 0; i < 1'000'000; ++i) //STD test loop.
{
const auto wstrSTD = std::format(L"std::format {}\n", i);
sum1 += wstrSTD.size();
}
const auto tSTDEnd = std::chrono::high_resolution_clock::now();
const auto tFMTStart = std::chrono::high_resolution_clock::now();
size_t sum2 { };
for (auto i = 0; i < 1'000'000; ++i) //FMT test loop.
{
const auto wstrFMT = fmt::format(L"fmt::format {}\n", i);
sum2 += wstrFMT.size();
}
const auto tFMTEnd = std::chrono::high_resolution_clock::now();
const auto durationSTD = std::chrono::duration_cast<std::chrono::microseconds>(tSTDEnd - tSTDStart).count();
const auto durationFMT = std::chrono::duration_cast<std::chrono::microseconds>(tFMTEnd - tFMTStart).count();
const auto wstrResult = std::format(L"STD duration: {}\nFMT duration: {}\nRatio is (std/fmt): {:.2f}\n",
durationSTD, durationFMT, static_cast<double>(durationSTD) / static_cast<double>(durationFMT));
std::wcout << wstrResult << std::endl;
return int(sum2 - sum1);
}
|
Yeah, it's because people distribute both static libraries and DLLs. I've filed #1802 to investigate improving |
Thanks for the feedback.
It varies from 1.02 to 1.06. |
Not sure if and when that is a problem in practice, but isn't it also dangerous if pre and/or post conditions of a function changes, even if the signature remains the same? |
Yes, that can be dangerous - it's typically a concern for internal functions, when we make coordinated changes to two or more functions. (Thus we have a few "v2", "v3", etc. functions/classes, which avoids any old TUs accidentally picking up new implementations partially.) Interestingly, if the signature changes and we're using C++ mangling, it's fine - the different mangled name is like a rename. It's not typically a concern for Standard functions where the pre/post-conditions aren't under our control. An entire book could be written about making ABI-safe changes. |
Sad to hear. If if not mistaken P2216 is already scheduled for plenary vote. |
[STL]
[STL]
What does this mean in light of multiple in-flight Ranges papers which have ABI impact (split, default construction, and join)? As well as the still-being-designed user-facing design for range adaptor closure objects so that users can write their own range adaptors? @CaseyCarter |
In the second quarter of 2021, our top priority (again) is finishing C++20 for VS 2019 16.10. (See our C++20 Features project and Conformance milestone.) We continue to welcome PRs that fix bugs, improve performance/throughput, and so forth, but code reviews may be significantly delayed as we focus on C++20. We expect to be done in mid-April.
After finishing C++20, we'll have the capacity to work on:
At this time, we aren't planning to start work on the vNext ABI-incompatible release in this quarter. vNext is different from "Dev17" 17.0, which will be ABI-compatible. Except for PRs specifically ported to 16.10, all changes are automatically flowing into 17.0 now, as recorded in the Changelog.
If you have questions about our plans for this quarter, feel free to ask them here. (Note that compiler, IDE, etc. priorities are off-topic.)
The text was updated successfully, but these errors were encountered: