Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 1930 invoked from network); 11 Dec 2006 20:53:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Dec 2006 20:53:42 -0000 Received: (qmail 94307 invoked by uid 500); 11 Dec 2006 20:53:50 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 94295 invoked by uid 500); 11 Dec 2006 20:53:50 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 94274 invoked by uid 99); 11 Dec 2006 20:53:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Dec 2006 12:53:50 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Dec 2006 12:53:41 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A546B71413F for ; Mon, 11 Dec 2006 12:53:21 -0800 (PST) Message-ID: <32144753.1165870401673.JavaMail.jira@brutus> Date: Mon, 11 Dec 2006 12:53:21 -0800 (PST) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Resolved: (STDCXX-7) std::operator<<(ostream&, const char*) inefficient for unbuffered file I/O In-Reply-To: <384252751.1122498078323.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/STDCXX-7?page=all ] Martin Sebor resolved STDCXX-7. ------------------------------- Resolution: Fixed Running the program after applying the referenced patch shows just a single call to write(1): $ truss -t write ./t abcdef write(3, " a b c d e f\n", 7) = 7 > std::operator<<(ostream&, const char*) inefficient for unbuffered file I/O > -------------------------------------------------------------------------- > > Key: STDCXX-7 > URL: http://issues.apache.org/jira/browse/STDCXX-7 > Project: C++ Standard Library > Issue Type: Bug > Components: 27. Input/Output > Affects Versions: 4.1.2 > Environment: All. > Reporter: Martin Sebor > Assigned To: Martin Sebor > Fix For: 4.2 > > > operator<<(ostream&, const char*) is inefficient when the stream argument is an unbuffered fstream object: it causes a call to write() for each character (ditto for the wide character versions). This affects all platforms. Here's a test case with HP aCC: > $ cat t.cpp && nice gmake SRCS=t.cpp && truss -o truss.out ./t && grep write truss.out > #include > int main () > { > std::ofstream f ("/dev/tty"); > f.rdbuf ()->pubsetbuf (0, 0); > f << "abcdef\n"; > } > aCC -c -I/build/sebor/dev/stdlib/include/ansi -I/usr/include -D_RWSTDDEBUG -mt -D_RWSTD_USE_CONFIG -I/build/sebor/aCC-3.63-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -Aa +nostl -g +d +w +W392 +W655 +W684 +W818 +W819 +W849 t.cpp > aCC t.o -o t -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings -L/build/sebor/aCC-3.63-15s/lib -mt -L/build/sebor/aCC-3.63-15s/lib -lstd15s -lm > abcdef > write(4, "a ", 1) = 1 > write(4, "b ", 1) = 1 > write(4, "c ", 1) = 1 > write(4, "d ", 1) = 1 > write(4, "e ", 1) = 1 > write(4, "f ", 1) = 1 > write(4, "\n", 1) = 1 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira