[patch, libstdc++] In debug mode, diagnose empty initializer_list in min/max/minmax

2016-02-23 Thread Eelis
The std::min, std::max, and std::minmax overloads that take a std::initializer_list all require that the list is not empty. The attached patch adds debug mode checks for this. Thanks, Eelis Index: libstdc++-v3/include/debug/formatter.h

Re: [PATCH] Implement -fdiagnostics-parseable-fixits

2016-08-18 Thread Eelis
On 2016-06-22 05:25, David Malcolm wrote: Clang has an option -fdiagnostics-parseable-fixits, which emits a machine-readable version of the fixits, for use by IDEs. (The only IDE I know of that supports this format is Xcode [1]; does anyone know of other IDEs supporting this? I'd be very happy

Re: [patch, libstdc++] std::shuffle: Generate two swap positions at a time if possible

2016-09-02 Thread Eelis
On 2016-09-02 20:20, Eelis van der Weegen wrote: On 2016-08-31 14:45, Jonathan Wakely wrote: Is this significantly faster than just using uniform_int_distribution<_IntType>{0, __bound - 1}(__g) so we don't need to duplicate the logic? (And people maintaining the code won't recon

Re: [patch, libstdc++] std::shuffle: Generate two swap positions at a time if possible

2016-05-25 Thread Eelis
On 2016-05-01 16:18, Eelis wrote: The attached patch optimizes std::shuffle for the very common case where the generator range is large enough that a single invocation can produce two swap positions. This reduces the runtime of the following testcase by 37% on my machine: Gentle ping. :) Did

[patch] libstdc++: Make std::shuffle faster by avoiding std::uniform_int_distribution

2016-04-30 Thread Eelis
_distribution when the generator's range is large enough, which is almost always the case. This helps a lot, because std::uniform_int_distribution::op() recomputes scaling factors every time. Thoughts? Thanks, Eelis Index: libstdc++

Re: [patch] libstdc++: Make std::shuffle faster by avoiding std::uniform_int_distribution

2016-04-30 Thread Eelis
Please ignore this, I made the error described here: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Implementation_errors :) On 2016-04-30 21:15, Eelis wrote: Hi, The attached patch makes std::shuffle about 33% faster for the following testcase: #include #include

[patch, libstdc++] std::shuffle: Generate two swap positions at a time if possible

2016-05-01 Thread Eelis
<< v.front() << '\n'; } Thoughts? Thanks, Eelis Index: libstdc++-v3/include/bits/stl_algo.h === --- libstdc++-v3/include/bits/stl_algo.h (revision 235680) +++ libstdc++-v3/include/bits/stl_algo.h (working cop

Re: [patch, libstdc++] std::shuffle: Generate two swap positions at a time if possible

2016-05-01 Thread Eelis
Sorry, forgot to include the libstdc++ list. On 2016-05-01 16:18, Eelis wrote: Hi, The attached patch optimizes std::shuffle for the very common case where the generator range is large enough that a single invocation can produce two swap positions. This reduces the runtime of the following

[PATCH] Forward to correct function in std::shared_mutex::unlock().

2015-08-12 Thread Eelis
Looks like a typo. :) Index: libstdc++-v3/include/std/shared_mutex === --- libstdc++-v3/include/std/shared_mutex (revision 226840) +++ libstdc++-v3/include/std/shared_mutex (working copy) @@ -331,7 +331,7 @@ void lock() { _M_im

[patch libstdc++] Fix assignability check in uninitialized_copy

2014-12-27 Thread Eelis
std::uninitialized_copy tries to test assignability as follows: is_assignable<_ValueType1, _RefType>::value This is the wrong way around. For example, when the iterators are char*, this ends up as is_assignable::value which is false. It should be is_assignable::value which is tr

Re: [patch libstdc++] Fix assignability check in uninitialized_copy

2015-01-09 Thread Eelis
On 2015-01-09 19:03, Jonathan Wakely wrote: The attached patch should be correct. Tested x86_64-linux, committed to trunk and 4.9. Awesome, thanks!

Re: [patch, libstdc++] In debug mode, diagnose empty initializer_list in min/max/minmax

2016-02-25 Thread Eelis van der Weegen
On 2016-02-23 23:39, Jonathan Wakely wrote: On 23/02/16 22:03 +0100, Eelis wrote: The std::min, std::max, and std::minmax overloads that take a std::initializer_list all require that the list is not empty. The attached patch adds debug mode checks for this. Nice, thanks for the patch. Hi

Re: [patch, libstdc++] std::shuffle: Generate two swap positions at a time if possible

2016-09-01 Thread Eelis van der Weegen
On 2016-09-01 17:14, Jonathan Wakely wrote: On 31/08/16 13:45 +0100, Jonathan Wakely wrote: On 03/05/16 16:42 +0200, Eelis van der Weegen wrote: Ah, thanks, I forgot to re-attach when I sent to include the libstdc++ list. On 2016-05-03 14:38, Jonathan Wakely wrote: ENOPATCH On 1 May 2016 at

Re: [patch, libstdc++] std::shuffle: Generate two swap positions at a time if possible

2016-09-02 Thread Eelis van der Weegen
On 2016-08-31 14:45, Jonathan Wakely wrote: Is this significantly faster than just using uniform_int_distribution<_IntType>{0, __bound - 1}(__g) so we don't need to duplicate the logic? (And people maintaining the code won't reconvince themselves it's correct every time they look at it :-) [..]

[patch, libstdc++] Optimize selection sampling by using generator to get two values at once

2016-10-19 Thread Eelis van der Weegen
This is the same optimization as was recently applied to std::shuffle. It reduces the runtime of the following program by 20% on my machine: int main() { std::vector a(1), b(1000); std::mt19937 gen; uint64_t c = 0;

Re: [patch, libstdc++] std::shuffle: Generate two swap positions at a time if possible

2016-05-03 Thread Eelis van der Weegen
Ah, thanks, I forgot to re-attach when I sent to include the libstdc++ list. On 2016-05-03 14:38, Jonathan Wakely wrote: ENOPATCH On 1 May 2016 at 15:21, Eelis wrote: Sorry, forgot to include the libstdc++ list. On 2016-05-01 16:18, Eelis wrote: Hi, The attached patch optimizes std