From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31764 invoked by alias); 10 Dec 2013 00:54:46 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31731 invoked by uid 48); 10 Dec 2013 00:54:42 -0000 From: "ben.maurer at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/59439] std::locale uses atomic instructions on construction Date: Tue, 10 Dec 2013 00:54:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ben.maurer at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00799.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59439 --- Comment #4 from Ben Maurer --- Also, here's where perf says time is being spent. While only 25% is shown as being in the locale constructor/destructor, I suspect that the time spent in other methods is actually related to the ping-ponging of cachelines caused by the constructor -- all the time is being spent in memory access which should be very hot in the CPU cache. 16.77% benchmark libstdc++.so.6.0.18 [.] std::locale::locale() 10.42% benchmark libstdc++.so.6.0.18 [.] std::locale::~locale() 9.93% benchmark libstdc++.so.6.0.18 [.] bool std::has_facet > > >(std::locale const&) 9.84% benchmark libstdc++.so.6.0.18 [.] std::num_put > > const& std::use_facet > > >(std::locale const&) 9.26% benchmark libstdc++.so.6.0.18 [.] bool std::has_facet > > >(std::locale const&) 9.10% benchmark libstdc++.so.6.0.18 [.] std::num_get > > const& std::use_facet > > >(std::locale const&) 8.78% benchmark libstdc++.so.6.0.18 [.] std::ctype const& std::use_facet >(std::locale const&) 6.14% benchmark libstdc++.so.6.0.18 [.] std::locale::operator=(std::locale const&) 3.71% benchmark libstdc++.so.6.0.18 [.] std::__use_cache >::operator()(std::locale const&) const 3.66% benchmark libstdc++.so.6.0.18 [.] bool std::has_facet >(std::locale const&) 3.42% benchmark libstdc++.so.6.0.18 [.] __dynamic_cast 1.96% benchmark libstdc++.so.6.0.18 [.] std::locale::id::_M_id() const 0.89% benchmark benchmark [.] doIoStream()