performance analysis producer_consumer.cc TEST_T5
Theodore Papadopoulo
Theodore.Papadopoulo@sophia.inria.fr
Thu Feb 19 16:29:00 GMT 2004
dhruvbird@gmx.net said:
> Why can't the library have a configure option to determine whether the
> size() function will be O(N) or not. It would be easy to provide both
> versions in the library AFAIK.
And why can't we keep the size and incrementally keep it when it is
cheap to do so. When it is not (eg for splicing), we invalidate the
size and reestimate it (in 0(N)) the first time the size of the list
is requested.
This way people would have an O(N) cost in general and (hopefully often) a
constant cost between "safe" operations...
Now, this incurs a test and an increment for each addition/deletion
and I do not know the average cost increase because of that....
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------
More information about the Libstdc++
mailing list