-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix #239: Improve _Invoke_traits throughput #408
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
|
Does this make it more difficult to if constexpr-ize invoke by virtue of exposing its implementation details in more places? |
Maybe, but we can always undo or rework this later. While this change successfully built and passed all of the STL's tests, it failed in the compiler's test suite, with the internal-only "checked" build of the compiler (which contains additional assertions to verify compiler state). The failure looks like: This points to |
stl/inc/type_traits
Outdated
|
|
||
| template <class... _Types> | ||
| struct _Invoke_traits<void_t<decltype(_STD invoke(_STD declval<_Types>()...))>, | ||
| struct _Invoke_traits<void_t<decltype(_Invoker<_Types...>::_Call(_STD declval<_Types>()...))>, |
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.
The compiler folk have mentioned in the past that MSVC doesn't memoize the results of overload resolution but does memoize alias template expansions. I suspect we could improve throughput here by adding an alias template for decltype(_Invoker<_Types...>::_Call(_STD declval<_Types>()...)) a la:
template <class... _Types>
using _Meow = decltype(_Invoker<_Types...>::_Call(_STD declval<_Types>()...));and replacing the two occurrences of decltype(_Invoker<_Types...>::_Call(_STD declval<_Types>()...)) here with _Meow<_Types...>.
|
Thanks to Xiang Fan, the compiler bug has been fixed by Microsoft-internal MSVC-PR-222035 which will be available in VS 2019 16.6 (presumably Preview 1); we need to wait for that release, as we currently don't have a faster way to consume unreleased compilers. |
|
Unfortunately, we merged #585 which requires this PR to be updated. |
|
I'm testing an update. |
|
I went ahead and merged this since it passed our Microsoft-internal build and tests. (We checked in a GitHub test harness today, but we're still working through sporadic failures and long queue times.) Thanks for the throughput improvement! Compile times are a top customer concern, so every bit helps. |
Description
Checklist
Be sure you've read README.md and understand the scope of this repo.
If you're unsure about a box, leave it unchecked. A maintainer will help you.
_Uglyas perhttps://eel.is/c++draft/lex.name#3.1 or there are no product code changes.
verified by an STL maintainer before automated testing is enabled on GitHub,
leave this unchecked for initial submission).
members, adding virtual functions, changing whether a type is an aggregate
or trivially copyable, etc.).
the C++ Working Draft (including any cited standards), other WG21 papers
(excluding reference implementations outside of proposed standard wording),
and LWG issues as reference material. If they were derived from a project
that's already listed in NOTICE.txt, that's fine, but please mention it.
If they were derived from any other project (including Boost and libc++,
which are not yet listed in NOTICE.txt), you must mention it here,
so we can determine whether the license is compatible and what else needs
to be done.