This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/46447] New: std::atomic_flag slower than std::atomic_uchar


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]