Patch for the producer_consumer test -> by Felix Yen.
Dhruv Matani
dhruvbird@HotPOP.com
Tue Mar 23 16:01:00 GMT 2004
Hello,
Here is a patch for the producer_consumer.cc test that Felix Yen had
conveyed to me by provate email, so it should probably be merged with
mainline. The message body said:
<Quoting>
I haven't looked at the code for a while, but the version I ghost wrote
had a bug in it that made it much slower than it should be. The
producer's algorithm should be linear, but it's quadratic in most
cases. Strictly speaking, the test is still fair, but it dilutes the
cost of allocating with excessive/unnecessary container traversals.
I'd start by modifying the test as follows. The body of the push_back
method should not call size(); instead, it should look something like
this:
<End Quote>
//See patch for more info.
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.prod_consumer.fyw
Type: text/x-patch
Size: 1324 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040323/8456d76d/attachment.bin>
More information about the Libstdc++
mailing list