public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector
@ 2012-11-01 19:34 chri.snell at gmail dot com
2012-11-01 19:39 ` [Bug libstdc++/55169] " paolo.carlini at oracle dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: chri.snell at gmail dot com @ 2012-11-01 19:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55169
Bug #: 55169
Summary: std::discrete_distribution::operator(generator&) makes
unnecessary copy of parameter vector
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: chri.snell@gmail.com
Created attachment 28592
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28592
demonstration of slow std::discrete_distribution in GCC
std::discrete_distribution::operator()(generator&) is significantly slower than
directly calling operator()(generator&, const param_type&), which it delegates
to. This is because, on random.h:4805, this->param() returns a copy rather
than a const reference.
The attached file is a simple test demonstrating this inefficient behaviour.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/55169] std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector
2012-11-01 19:34 [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector chri.snell at gmail dot com
@ 2012-11-01 19:39 ` paolo.carlini at oracle dot com
2012-11-01 19:48 ` chri.snell at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-01 19:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55169
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-11-01
AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot
|gnu.org |com
Ever Confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-01 19:38:51 UTC ---
Yes, seems easy to fix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/55169] std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector
2012-11-01 19:34 [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector chri.snell at gmail dot com
2012-11-01 19:39 ` [Bug libstdc++/55169] " paolo.carlini at oracle dot com
@ 2012-11-01 19:48 ` chri.snell at gmail dot com
2012-11-01 20:00 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: chri.snell at gmail dot com @ 2012-11-01 19:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55169
--- Comment #2 from Chris Nell <chri.snell at gmail dot com> 2012-11-01 19:48:43 UTC ---
After a bit more poking, it appears that param() returns a copy (not a const
reference) for all distributions, not just discrete_distribution. As such, it
might we worth looking into whether other implementations of
operator(generator&) suffer from the same bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/55169] std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector
2012-11-01 19:34 [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector chri.snell at gmail dot com
2012-11-01 19:39 ` [Bug libstdc++/55169] " paolo.carlini at oracle dot com
2012-11-01 19:48 ` chri.snell at gmail dot com
@ 2012-11-01 20:00 ` paolo.carlini at oracle dot com
2012-11-02 10:46 ` paolo at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-01 20:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55169
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-01 19:59:48 UTC ---
Of course, of course. But in 4_7-branch we are going to change only the three
distributions using std::vectors
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/55169] std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector
2012-11-01 19:34 [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector chri.snell at gmail dot com
` (2 preceding siblings ...)
2012-11-01 20:00 ` paolo.carlini at oracle dot com
@ 2012-11-02 10:46 ` paolo at gcc dot gnu.org
2012-11-02 11:18 ` paolo at gcc dot gnu.org
2012-11-02 11:20 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-11-02 10:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55169
--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-11-02 10:45:40 UTC ---
Author: paolo
Date: Fri Nov 2 10:45:25 2012
New Revision: 193092
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193092
Log:
2012-11-02 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/55169
* include/bits/random.h: Remove all uses of param().
(chi_squared_distribution<>::__generate_impl(_ForwardIterator,
_ForwardIterator, _UniformRandomNumberGenerator&): Declare
* include/bits/random.tcc: ... define.
* include/ext/random: Remove all uses of param().
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/random.h
trunk/libstdc++-v3/include/bits/random.tcc
trunk/libstdc++-v3/include/ext/random
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/55169] std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector
2012-11-01 19:34 [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector chri.snell at gmail dot com
` (3 preceding siblings ...)
2012-11-02 10:46 ` paolo at gcc dot gnu.org
@ 2012-11-02 11:18 ` paolo at gcc dot gnu.org
2012-11-02 11:20 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-11-02 11:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55169
--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-11-02 11:18:22 UTC ---
Author: paolo
Date: Fri Nov 2 11:18:13 2012
New Revision: 193093
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193093
Log:
2012-11-02 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/55169
* include/bits/random.h: Remove all uses of param().
Modified:
branches/gcc-4_7-branch/libstdc++-v3/ChangeLog
branches/gcc-4_7-branch/libstdc++-v3/include/bits/random.h
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/55169] std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector
2012-11-01 19:34 [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector chri.snell at gmail dot com
` (4 preceding siblings ...)
2012-11-02 11:18 ` paolo at gcc dot gnu.org
@ 2012-11-02 11:20 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-02 11:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55169
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.7.3
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-02 11:19:37 UTC ---
Fixed mainline and 4.7.3.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-11-02 11:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 19:34 [Bug libstdc++/55169] New: std::discrete_distribution::operator(generator&) makes unnecessary copy of parameter vector chri.snell at gmail dot com
2012-11-01 19:39 ` [Bug libstdc++/55169] " paolo.carlini at oracle dot com
2012-11-01 19:48 ` chri.snell at gmail dot com
2012-11-01 20:00 ` paolo.carlini at oracle dot com
2012-11-02 10:46 ` paolo at gcc dot gnu.org
2012-11-02 11:18 ` paolo at gcc dot gnu.org
2012-11-02 11:20 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).