This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/46447] std::atomic_flag slower than std::atomic_uchar
- From: "bkoz at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 03 Feb 2012 21:23:44 +0000
- Subject: [Bug libstdc++/46447] std::atomic_flag slower than std::atomic_uchar
- Auto-submitted: auto-generated
- References: <bug-46447-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46447
--- Comment #3 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-03 21:23:44 UTC ---
Just an update on this...
with gcc-4.7 2012-02-03
-g -O2
%./a-02.out
spin_mutex_tt took 84.0168 cycles (averaged over 10000 trials)
af_set_tt took 36.7017 cycles (averaged over 10000 trials)
af_clear_tt took 60.3904 cycles (averaged over 10000 trials)
aint_bit_set_tt took 52.4867 cycles (averaged over 10000 trials)
aint_clear_tt took 60.3904 cycles (averaged over 10000 trials)
auchar_bit_set_tt took 52.4867 cycles (averaged over 10000 trials)
auchar_clear_tt took 60.3911 cycles (averaged over 10000 trials)
sizeof(aint) = 4 sizeof(auchar) = 1 sizeof(std::atomic_flag) = 1
-g -O3
%./a-03.out
spin_mutex_tt took 84.0168 cycles (averaged over 10000 trials)
af_set_tt took 36.7017 cycles (averaged over 10000 trials)
af_clear_tt took 60.3904 cycles (averaged over 10000 trials)
aint_bit_set_tt took 52.486 cycles (averaged over 10000 trials)
aint_clear_tt took 60.3911 cycles (averaged over 10000 trials)
auchar_bit_set_tt took 52.4867 cycles (averaged over 10000 trials)
auchar_clear_tt took 60.3911 cycles (averaged over 10000 trials)
sizeof(aint) = 4 sizeof(auchar) = 1 sizeof(std::atomic_flag) = 1
So, it looks like atomic_flag set is now faster (!), but that the clears are
comparable.
I'd like to generalize this test case for the performance testsuite.