[RFC] libstdc++ atomicity, x86 agnostic version

Jakub Jelinek jakub@redhat.com
Wed Feb 25 20:34:00 GMT 2004


On Wed, Feb 25, 2004 at 09:26:16PM +0100, Paolo Carlini wrote:
> Paolo Carlini wrote:
> 
> >It's needed something completely different, but basically *every real 
> >world* test on a multi processor machine or in a MT environment can 
> >only be negatively affected by not inlining the operations done at 
> >construction and destruction time.
> 
> Of course non-MT performance is affected too (as soon as you construct 
> and destroy many times, basically, always in the real world ;), only, in 
> that case, one can conceivably remove completely the atomic operations.

Being a non-C++ writer, I'm afraid I can cook up just simple synthetic tests
like which clearly use _M_refcopy and _M_dispose a lot.

#include <string>

using namespace std;

void foo (string &x)
{
}

int main (void)
{
  string s = "abc";
  for (int i = 0; i < 100000; ++i)
    {
      string t = s;
      foo (t);
    }
}

	Jakub



More information about the Libstdc++ mailing list