diff mbox series

[v26,07/13] libstdc++: Optimize std::remove_all_extents compilation performance

Message ID 20240511090130.248174-7-kmatsui@gcc.gnu.org
State New
Headers show
Series [v26,01/13] libstdc++: Optimize std::is_const compilation performance | expand

Commit Message

Ken Matsui May 11, 2024, 9:01 a.m. UTC
This patch optimizes the compilation performance of
std::remove_all_extents by dispatching to the new
__remove_all_extents built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (remove_all_extents): Use
	__remove_all_extents built-in trait.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/std/type_traits | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jonathan Wakely June 13, 2024, 12:33 p.m. UTC | #1
On 11/05/24 02:01 -0700, Ken Matsui wrote:
>This patch optimizes the compilation performance of
>std::remove_all_extents by dispatching to the new
>__remove_all_extents built-in trait.

OK, thanks.

>libstdc++-v3/ChangeLog:
>
>	* include/std/type_traits (remove_all_extents): Use
>	__remove_all_extents built-in trait.
>
>Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
>---
> libstdc++-v3/include/std/type_traits | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
>index 58281c2e38c..5b74e44d0a6 100644
>--- a/libstdc++-v3/include/std/type_traits
>+++ b/libstdc++-v3/include/std/type_traits
>@@ -2111,6 +2111,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> #endif
>
>   /// remove_all_extents
>+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
>+  template<typename _Tp>
>+    struct remove_all_extents
>+    { using type = __remove_all_extents(_Tp); };
>+#else
>   template<typename _Tp>
>     struct remove_all_extents
>     { using type = _Tp; };
>@@ -2122,6 +2127,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>   template<typename _Tp>
>     struct remove_all_extents<_Tp[]>
>     { using type = typename remove_all_extents<_Tp>::type; };
>+#endif
>
> #if __cplusplus > 201103L
>   /// Alias template for remove_extent
>-- 
>2.44.0
>
diff mbox series

Patch

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 58281c2e38c..5b74e44d0a6 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2111,6 +2111,11 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   /// remove_all_extents
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
+  template<typename _Tp>
+    struct remove_all_extents
+    { using type = __remove_all_extents(_Tp); };
+#else
   template<typename _Tp>
     struct remove_all_extents
     { using type = _Tp; };
@@ -2122,6 +2127,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Tp>
     struct remove_all_extents<_Tp[]>
     { using type = typename remove_all_extents<_Tp>::type; };
+#endif
 
 #if __cplusplus > 201103L
   /// Alias template for remove_extent