This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Nathan's improvements to basic_string
Apologies for replying to my own post again; I have more numbers.
On Tue, Jun 17, 2003 at 11:43:19AM -0700, Nathan Myers wrote:
> On Fri, Jun 13, 2003 at 02:59:34PM -0700, Nathan Myers wrote:
> >
> > I did some testing on a 1.4 GHz Opteron, which generally seems
> > comparable to a 2.4GHz P4.
> A lock/add seems to cost 11.6 ns, or [16] cycles, on this hardware when
> there is no contention.
I tried it with two threads on a dual Opteron. With the patch the
runtime was exactly the same as with one thread. Without, it was
from 20 to 50 times slower, and 4 to 10 times slower than with
one thread. That implies a contested-lock/add time of somewhere
in the ballbark of 50 - 120 ns, or 65 - 160 cycles, on this hardware.
A p4 would be different, and a p4 with 800MHz bus would be different
again.
The actual effect of the patch on the performance of real, multi-threaded
programs that make heavy use of strings has yet to be reported. All we
can be sure of is that it's better with the patch than without.
Nathan Myers
ncm-nospam@cantrip.org