Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 78485 invoked from network); 9 Nov 2008 00:21:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Nov 2008 00:21:14 -0000 Received: (qmail 16788 invoked by uid 500); 9 Nov 2008 00:21:21 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 16762 invoked by uid 500); 9 Nov 2008 00:21:21 -0000 Mailing-List: contact issues-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list issues@stdcxx.apache.org Received: (qmail 16751 invoked by uid 99); 9 Nov 2008 00:21:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Nov 2008 16:21:21 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Nov 2008 00:20:01 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 34F7E234C288 for ; Sat, 8 Nov 2008 16:20:44 -0800 (PST) Message-ID: <742874501.1226190044201.JavaMail.jira@brutus> Date: Sat, 8 Nov 2008 16:20:44 -0800 (PST) From: "Martin Sebor (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Issue Comment Edited: (STDCXX-914) sstream ctors inefficient in reentrant modes In-Reply-To: <1774712964.1210133395826.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646015#action_12646015 ] sebor edited comment on STDCXX-914 at 11/8/08 4:18 PM: -------------------------------------------------------------- Here are the top 10 functions from the {{[stdcxx-914-gprof-gcc-4.3.0-12S.txt|https://issues.apache.org/jira/secure/attachment/12393570/stdcxx-914-gprof-gcc-4.3.0-12S.txt]}} attachment (with template argument lists removed for better readability). Looks like the {{_C_is_managed()}} function could stand to be optimized... {noformat} Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 32.40 2.99 2.99 30000000 0.00 0.00 __rw::__rw_locale::_C_is_managed(int) const 13.98 4.28 1.29 50000000 0.00 0.00 __rw::__rw_locale::_C_manage(__rw::__rw_locale*, char const*) 6.83 4.91 0.63 10000000 0.00 0.00 std::istream& std::operator>>(std::istream&, std::string&) 4.98 5.37 0.46 10000001 0.00 0.00 std::string::operator=(std::string const&) 4.98 5.83 0.46 10000000 0.00 0.00 std::ostream& __rw::__rw_insert(std::ostream&, long) 4.66 6.26 0.43 10000000 0.00 0.00 std::num_put::_C_put(std::ostreambuf_iterator, std::ios_base&, char, int, void const*) const 3.36 6.57 0.31 10000000 0.00 0.00 std::string lex_cast(long const&) 3.25 6.87 0.30 10000000 0.00 0.00 __rw::__rw_dtoa(char*, unsigned long, unsigned int) 3.03 7.15 0.28 main 2.49 7.38 0.23 30000000 0.00 0.00 std::locale::~locale() ... {noformat} was (Author: sebor): Here are the top 10 functions from the {{[stdcxx-914-gprof-gcc-4.3.0-12S.txt|https://issues.apache.org/jira/secure/attachment/12393570/stdcxx-914-gprof-gcc-4.3.0-12S.txt]}} attachment. Looks like the {{_C_is_managed()}} function could stand to be optimized... {noformat} Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 32.40 2.99 2.99 30000000 0.00 0.00 __rw::__rw_locale::_C_is_managed(int) const 13.98 4.28 1.29 50000000 0.00 0.00 __rw::__rw_locale::_C_manage(__rw::__rw_locale*, char const*) 6.83 4.91 0.63 10000000 0.00 0.00 std::istream& std::operator>>, std::allocator >(std::istream&, std::string&) 4.98 5.37 0.46 10000001 0.00 0.00 std::string::operator=(std::string const&) 4.98 5.83 0.46 10000000 0.00 0.00 std::ostream& __rw::__rw_insert, long>(std::ostream&, long) 4.66 6.26 0.43 10000000 0.00 0.00 std::num_put > >::_C_put(std::ostreambuf_iterator >, std::ios_base&, char, int, void const*) const 3.36 6.57 0.31 10000000 0.00 0.00 std::string lex_cast(long const&) 3.25 6.87 0.30 10000000 0.00 0.00 __rw::__rw_dtoa(char*, unsigned long, unsigned int) 3.03 7.15 0.28 main 2.49 7.38 0.23 30000000 0.00 0.00 std::locale::~locale() ... {noformat} > sstream ctors inefficient in reentrant modes > -------------------------------------------- > > Key: STDCXX-914 > URL: https://issues.apache.org/jira/browse/STDCXX-914 > Project: C++ Standard Library > Issue Type: Improvement > Components: 27. Input/Output > Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0, 4.2.1 > Reporter: Martin Sebor > Priority: Critical > Fix For: 4.2.2 > > Attachments: stdcxx-914-gprof-gcc-4.1.2-12D.txt, stdcxx-914-gprof-gcc-4.3.0-12S.txt > > Original Estimate: 12h > Time Spent: 2.5h > Remaining Estimate: 9.5h > > As discussed in this [thread|http://markmail.org/message/hqlsw5dq23gx7d4o] stream ctors in thread-safe builds are inefficient due to the initialization of the mutex data member in every stream, even in those that never use it. As soon as binary compatibility rules permit it we should remove the mutex and/or defer its initialization until it's needed. It might be possible to implement the deferred initialization as early as 4.2.2, or maybe 4.3. Complete removal will need to wait until 5.0. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.