Re: [PATCH] Optimize seed_seq construction

2021-08-17 Thread Jonathan Wakely via Gcc-patches
On Tue, 17 Aug 2021 at 14:40, Antony Polukhin wrote: > > вт, 17 авг. 2021 г. в 16:37, Jonathan Wakely : > <...> > > Thanks, this is a nice improvement. We can avoid tag dispatching to > > make it simpler though: > > > > @@ -3248,6 +3249,9 @@ namespace __detail > > template > > seed_seq::seed

Re: [PATCH] Optimize seed_seq construction

2021-08-17 Thread Antony Polukhin via Gcc-patches
вт, 17 авг. 2021 г. в 16:37, Jonathan Wakely : <...> > Thanks, this is a nice improvement. We can avoid tag dispatching to > make it simpler though: > > @@ -3248,6 +3249,9 @@ namespace __detail > template > seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end) > { > + if _

Re: [PATCH] Optimize seed_seq construction

2021-08-17 Thread Jonathan Wakely via Gcc-patches
On Tue, 17 Aug 2021 at 09:42, Antony Polukhin wrote: > > When std::seed_seq is constructed from random access iterators we can > detect the internal vector size in O(1). Reserving memory for elements > in such cases may avoid multiple memory allocations. > > libstdc++-v3/ChangeLog: > > * in

[PATCH] Optimize seed_seq construction

2021-08-17 Thread Antony Polukhin via Gcc-patches
When std::seed_seq is constructed from random access iterators we can detect the internal vector size in O(1). Reserving memory for elements in such cases may avoid multiple memory allocations. libstdc++-v3/ChangeLog: * include/bits/random.tcc: Optimize seed_seq construction. -- Best re