On Fri, Aug 21, 2026 at 8:25 PM Jonathan Wakely <[email protected]> wrote: > > On Fri, 21 Aug 2026 at 20:23 +0800, Yuao Ma wrote: > >On Thu, Aug 20, 2026 at 11:34 PM Jonathan Wakely <[email protected]> wrote: > >> > >> On Thu, 20 Aug 2026 at 14:38, Yuao Ma <[email protected]> wrote: > >> > > >> > Hi! > >> > > >> > Based on previous discussions, we could remove the gnu++11 flag in the > >> > check performance script. And the rebind logic removed in c++20 is > >> > also adjusted. > >> > >> This makes the pb_ds performance tests unable to run as C++98, because > >> that doesn't have std::allocator_traits. So if anybody wanted to > >> compare performance of those containers in C++98 and C++20 (or C++11), > >> maybe because they were adding move semantics to the pb_ds containers, > >> the performance tests would not work. > >> > >> Although I really don't care about the pb_ds tests (because pb_ds is > >> unmaintained and should be moved to a separate repo), you could make > >> it work for all versions of C++ by using __gnu_cxx::__alloc_traits > >> instead of std::allocator_traits. > >> > > > >Thanks for the review! Indeed when I made the change in the patch I > >did not think about the compatibility of c++98. Fixed in the new > >patch. > > > >> > > >> > Tested with make check-performance, ok for trunk? > >> > > >> > Thanks, > >> > Yuao > >> > > >From b243166201265b86491044b20bdba79116766ae6 Mon Sep 17 00:00:00 2001 > >From: Yuao Ma <[email protected]> > >Date: Fri, 21 Aug 2026 20:21:13 +0800 > >Subject: [PATCH] libstdc++: remove the gnu++11 in check performance script > > > >Nowadays gcc's default c++ version is gnu++20, maybe we should just use > >this in performance check as well. > > > >libstdc++-v3/ChangeLog: > > > > * scripts/check_performance: Remove gnu++11 flag. > > * testsuite/util/native_type/native_hash_map.hpp: Adjust rebind > > usage. > > * testsuite/util/native_type/native_hash_multimap.hpp: Ditto. > > * testsuite/util/native_type/native_hash_set.hpp: Ditto. > > * testsuite/util/native_type/native_map.hpp: Ditto. > > * testsuite/util/native_type/native_multimap.hpp: Ditto. > > * testsuite/util/native_type/native_set.hpp: Ditto. > >--- > > libstdc++-v3/scripts/check_performance | 2 +- > > .../testsuite/util/native_type/native_hash_map.hpp | 2 +- > > .../testsuite/util/native_type/native_hash_multimap.hpp | 4 +--- > > .../testsuite/util/native_type/native_hash_set.hpp | 2 +- > > libstdc++-v3/testsuite/util/native_type/native_map.hpp | 4 ++-- > > .../testsuite/util/native_type/native_multimap.hpp | 7 ++----- > > libstdc++-v3/testsuite/util/native_type/native_set.hpp | 2 +- > > 7 files changed, 9 insertions(+), 14 deletions(-) > > > >diff --git a/libstdc++-v3/scripts/check_performance > >b/libstdc++-v3/scripts/check_performance > >index 4831ed71b6f..eb6adbc5ec6 100755 > >--- a/libstdc++-v3/scripts/check_performance > >+++ b/libstdc++-v3/scripts/check_performance > >@@ -32,7 +32,7 @@ SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \ > > -Wl,--rpath -Wl,$BUILD_DIR/src/.libs" > > ST_FLAG="-static" > > LINK=$SH_FLAG > >-CXX="$COMPILER $INCLUDES $FLAGS -std=gnu++11 $CXXFLAGS $LINK" > >+CXX="$COMPILER $INCLUDES $FLAGS $CXXFLAGS $LINK" > > LIBS="./libtestc++.a" > > TESTS_FILE="testsuite_files_performance" > > > >diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp > >b/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp > >index 1eb9851c886..0c0ecaeaa6b 100644 > >--- a/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp > >+++ b/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp > >@@ -50,7 +50,7 @@ namespace __gnu_pbds > > { > > #define PB_DS_BASE_C_DEC \ > > std::tr1::__unordered_map<Key, Data, Hash_Fn, Eq_Fn, \ > >- typename _Alloc::template rebind<std::pair<const Key, Data> >::other, > >Cache_Hash> > >+ typename __gnu_cxx::__alloc_traits<_Alloc>::template > >rebind_alloc<std::pair<const Key, Data>>, Cache_Hash> > > For C++98 compatibility we need a space between the >> tokens. > > > > > template<typename Key, > > typename Data, > >diff --git > >a/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp > >b/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp > >index 35f16de8a1c..f6808aab9d1 100644 > >--- a/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp > >+++ b/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp > >@@ -70,9 +70,7 @@ namespace __gnu_pbds > > typedef typename base_type::iterator iterator; > > typedef typename base_type::const_iterator const_iterator; > > > >- typedef > >- typename allocator::template rebind<pair_type>::other::const_reference > >- const_reference; > >+ typedef const pair_type& const_reference; > > > > native_hash_multimap() : base_type(Init_Size) > > { } > >diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp > >b/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp > >index 75ebed43110..27bc4d76d3d 100644 > >--- a/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp > >+++ b/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp > >@@ -50,7 +50,7 @@ namespace __gnu_pbds > > { > > #define PB_DS_BASE_C_DEC \ > > std::tr1::__unordered_set<Key, Hash_Fn, Eq_Fn, \ > >- typename _Alloc::template rebind<Key>::other, Cache_Hash> > >+ typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind_alloc<Key>, > >Cache_Hash> > > > > template<typename Key, > > size_t Init_Size = 8, > >diff --git a/libstdc++-v3/testsuite/util/native_type/native_map.hpp > >b/libstdc++-v3/testsuite/util/native_type/native_map.hpp > >index 958553951b4..1617ed27e20 100644 > >--- a/libstdc++-v3/testsuite/util/native_type/native_map.hpp > >+++ b/libstdc++-v3/testsuite/util/native_type/native_map.hpp > >@@ -49,8 +49,8 @@ namespace __gnu_pbds > > namespace test > > { > > #define PB_DS_BASE_C_DEC \ > >- std::map<Key, Data, Cmp_Fn, \ > >-typename _Alloc::template rebind<std::pair<const Key, Data > >::other > > >+ std::map<Key, Data, Cmp_Fn, \ > >+ typename __gnu_cxx::__alloc_traits<_Alloc>::template > >rebind_alloc<std::pair<const Key, Data>>> > > And here. > > > > > template<typename Key, typename Data, class Cmp_Fn = std::less<Key>, > > typename _Alloc = std::allocator<char> > > >diff --git a/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp > >b/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp > >index 3646de930b4..eea682131cd 100644 > >--- a/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp > >+++ b/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp > >@@ -48,7 +48,7 @@ namespace __gnu_pbds > > { > > #define PB_DS_BASE_C_DEC \ > > std::multimap<Key, Data, Less_Fn, \ > >- typename _Alloc::template rebind<std::pair<const Key, Data> >::other> > >+ typename __gnu_cxx::__alloc_traits<_Alloc>::template > >rebind_alloc<std::pair<const Key, Data>>> > > And here. > > > > > template<typename Key, typename Data, class Less_Fn = std::less<Key>, > > typename _Alloc = std::allocator<char> > > >@@ -62,10 +62,7 @@ namespace __gnu_pbds > > > > typedef _Alloc allocator; > > > >- typedef > >- typename _Alloc::template rebind< > >- std::pair<Key, Data> >::other::const_reference > >- const_reference; > >+ typedef const std::pair<Key, Data>& const_reference; > > > > typedef typename base_type::iterator iterator; > > typedef typename base_type::const_iterator const_iterator; > >diff --git a/libstdc++-v3/testsuite/util/native_type/native_set.hpp > >b/libstdc++-v3/testsuite/util/native_type/native_set.hpp > >index d382a371226..d26e665843a 100644 > >--- a/libstdc++-v3/testsuite/util/native_type/native_set.hpp > >+++ b/libstdc++-v3/testsuite/util/native_type/native_set.hpp > >@@ -48,7 +48,7 @@ namespace __gnu_pbds > > namespace test > > { > > #define PB_DS_BASE_C_DEC \ > >- std::set<Key, Cmp_Fn, typename _Alloc::template rebind<Key>::other> > >+ std::set<Key, Cmp_Fn, typename > >__gnu_cxx::__alloc_traits<_Alloc>::template rebind_alloc<Key>> > > And here. > > OK for trunk with those changes, thanks. >
After some checking it seems that __gnu_cxx::__alloc_traits does not support rebind_alloc in gnu++98 : ( So in the new patch I switch to conditional macros. Both 98 and 20 are verified now. And for c++11 and above we can simply use the standard traits. > > > > template<typename Key, class Cmp_Fn = std::less<Key>, > > typename _Alloc = std::allocator<char> > > >-- > >2.54.0 > > >
From d998697567cb7c66fd72dabeed2429fca7c7fd16 Mon Sep 17 00:00:00 2001 From: Yuao Ma <[email protected]> Date: Fri, 21 Aug 2026 20:44:57 +0800 Subject: [PATCH] libstdc++: remove the gnu++11 in check performance script Nowadays gcc's default c++ version is gnu++20, maybe we should just use this in performance check as well. libstdc++-v3/ChangeLog: * scripts/check_performance: Remove gnu++11 flag. * testsuite/util/native_type/native_hash_map.hpp: Adjust rebind usage. * testsuite/util/native_type/native_hash_multimap.hpp: Ditto. * testsuite/util/native_type/native_hash_set.hpp: Ditto. * testsuite/util/native_type/native_map.hpp: Ditto. * testsuite/util/native_type/native_multimap.hpp: Ditto. * testsuite/util/native_type/native_set.hpp: Ditto. --- libstdc++-v3/scripts/check_performance | 2 +- .../testsuite/util/native_type/native_hash_map.hpp | 6 ++++++ .../util/native_type/native_hash_multimap.hpp | 4 +--- .../testsuite/util/native_type/native_hash_set.hpp | 6 ++++++ .../testsuite/util/native_type/native_map.hpp | 6 ++++++ .../testsuite/util/native_type/native_multimap.hpp | 11 +++++++---- .../testsuite/util/native_type/native_set.hpp | 5 +++++ 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/scripts/check_performance b/libstdc++-v3/scripts/check_performance index 4831ed71b6f..eb6adbc5ec6 100755 --- a/libstdc++-v3/scripts/check_performance +++ b/libstdc++-v3/scripts/check_performance @@ -32,7 +32,7 @@ SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \ -Wl,--rpath -Wl,$BUILD_DIR/src/.libs" ST_FLAG="-static" LINK=$SH_FLAG -CXX="$COMPILER $INCLUDES $FLAGS -std=gnu++11 $CXXFLAGS $LINK" +CXX="$COMPILER $INCLUDES $FLAGS $CXXFLAGS $LINK" LIBS="./libtestc++.a" TESTS_FILE="testsuite_files_performance" diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp b/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp index 1eb9851c886..72f8bfbf023 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp @@ -48,9 +48,15 @@ namespace __gnu_pbds { namespace test { +#if __cplusplus >= 201103L +#define PB_DS_BASE_C_DEC \ + std::tr1::__unordered_map<Key, Data, Hash_Fn, Eq_Fn, \ + typename std::allocator_traits<_Alloc>::template rebind_alloc<std::pair<const Key, Data>>, Cache_Hash> +#else #define PB_DS_BASE_C_DEC \ std::tr1::__unordered_map<Key, Data, Hash_Fn, Eq_Fn, \ typename _Alloc::template rebind<std::pair<const Key, Data> >::other, Cache_Hash> +#endif template<typename Key, typename Data, diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp b/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp index 35f16de8a1c..f6808aab9d1 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp @@ -70,9 +70,7 @@ namespace __gnu_pbds typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; - typedef - typename allocator::template rebind<pair_type>::other::const_reference - const_reference; + typedef const pair_type& const_reference; native_hash_multimap() : base_type(Init_Size) { } diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp b/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp index 75ebed43110..5ef2e398917 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp @@ -48,9 +48,15 @@ namespace __gnu_pbds { namespace test { +#if __cplusplus >= 201103L +#define PB_DS_BASE_C_DEC \ + std::tr1::__unordered_set<Key, Hash_Fn, Eq_Fn, \ + typename std::allocator_traits<_Alloc>::template rebind_alloc<Key>, Cache_Hash> +#else #define PB_DS_BASE_C_DEC \ std::tr1::__unordered_set<Key, Hash_Fn, Eq_Fn, \ typename _Alloc::template rebind<Key>::other, Cache_Hash> +#endif template<typename Key, size_t Init_Size = 8, diff --git a/libstdc++-v3/testsuite/util/native_type/native_map.hpp b/libstdc++-v3/testsuite/util/native_type/native_map.hpp index 958553951b4..57b469adcd5 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_map.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_map.hpp @@ -48,9 +48,15 @@ namespace __gnu_pbds { namespace test { +#if __cplusplus >= 201103L +#define PB_DS_BASE_C_DEC \ + std::map<Key, Data, Cmp_Fn, \ +typename std::allocator_traits<_Alloc>::template rebind_alloc<std::pair<const Key, Data>>> +#else #define PB_DS_BASE_C_DEC \ std::map<Key, Data, Cmp_Fn, \ typename _Alloc::template rebind<std::pair<const Key, Data > >::other > +#endif template<typename Key, typename Data, class Cmp_Fn = std::less<Key>, typename _Alloc = std::allocator<char> > diff --git a/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp b/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp index 3646de930b4..50b5841ad7b 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp @@ -46,9 +46,15 @@ namespace __gnu_pbds { namespace test { +#if __cplusplus >= 201103L +#define PB_DS_BASE_C_DEC \ + std::multimap<Key, Data, Less_Fn, \ + typename std::allocator_traits<_Alloc>::template rebind_alloc<std::pair<const Key, Data>>> +#else #define PB_DS_BASE_C_DEC \ std::multimap<Key, Data, Less_Fn, \ typename _Alloc::template rebind<std::pair<const Key, Data> >::other> +#endif template<typename Key, typename Data, class Less_Fn = std::less<Key>, typename _Alloc = std::allocator<char> > @@ -62,10 +68,7 @@ namespace __gnu_pbds typedef _Alloc allocator; - typedef - typename _Alloc::template rebind< - std::pair<Key, Data> >::other::const_reference - const_reference; + typedef const std::pair<Key, Data>& const_reference; typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; diff --git a/libstdc++-v3/testsuite/util/native_type/native_set.hpp b/libstdc++-v3/testsuite/util/native_type/native_set.hpp index d382a371226..577e72466c5 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_set.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_set.hpp @@ -47,8 +47,13 @@ namespace __gnu_pbds { namespace test { +#if __cplusplus >= 201103L +#define PB_DS_BASE_C_DEC \ + std::set<Key, Cmp_Fn, typename std::allocator_traits<_Alloc>::template rebind_alloc<Key>> +#else #define PB_DS_BASE_C_DEC \ std::set<Key, Cmp_Fn, typename _Alloc::template rebind<Key>::other> +#endif template<typename Key, class Cmp_Fn = std::less<Key>, typename _Alloc = std::allocator<char> > -- 2.54.0
