This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/46447] New: std::atomic_flag slower than std::atomic_uchar
- From: "kyle.kloepper at riverbed dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 12 Nov 2010 01:29:20 +0000
- Subject: [Bug c++/46447] New: std::atomic_flag slower than std::atomic_uchar
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46447
Summary: std::atomic_flag slower than std::atomic_uchar
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: kyle.kloepper@riverbed.com
It seems to me that the operations for atomic_flag could be reimplemented with
an atomic_uchar. However it looks as though a atomic_uchar performs those
operations faster.
atomic_flag::test_and_set() took 24.0051 cycles (averaged over 10000 trials)
atomic_flag::clear() took 17.0037 cycles (averaged over 10000 trials)
atomic_int::operator|=(1) took 20.0046 cycles (averaged over 10000 trials)
atomic_int::operator=(0) took 10.2529 cycles (averaged over 10000 trials)
atomic_uchar::operator|=(1) took 20.0053 cycles (averaged over 10000 trials)
atomic_uchar::operator=(0) took 10.2522 cycles (averaged over 10000 trials)
sizeof(aint) = 4 sizeof(auchar) = 1 sizeof(std::atomic_flag) = 1