From mboxrd@z Thu Jan 1 00:00:00 1970 From: kw+gnats@cs.cmu.edu To: gcc-gnats@gcc.gnu.org Subject: libstdc++/4470: Thousands of seeks per read from cin Date: Thu, 04 Oct 2001 12:56:00 -0000 Message-id: <20011004195116.15804.qmail@sourceware.cygnus.com> X-SW-Source: 2001-10/msg00053.html List-Id: >Number: 4470 >Category: libstdc++ >Synopsis: Thousands of seeks per read from cin >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Oct 04 12:56:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Kevin Watkins >Release: gcc version 3.0.1 >Organization: >Environment: RedHat 7.1 (Linux 2.4.10 i686) gcc was built from source with ./configure && make && make install >Description: The following code: #include int main() { char buf[1024]; while (std::cin.read(buf, 1024)); } when compiled thus: g++ -static qwe.cc and run thus: ./a.out < /usr/dict/words generates thousands of seek system calls per read system call, as revealed by strace. This is an insurmountable performance problem. The problem is specific to cin; it has not been observed for files opened via the ifstream constructor. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: