Huge performance bottleneck with

Gabriel Dos Reis
Wed Mar 7 09:56:00 GMT 2001

Theodore Papadopoulo <> writes:

| [1  <text/plain; us-ascii (7bit)>]
| I have a huge performance problem with a call to a libstdc++-v3 
| function. istream::read. This is true only for I/O done with cin
| (by the way this is a regression with respect to g++-2.95.2 for two 
| reasons, see below)

Then, I'd suggest you fill in a GNATS note.


| With g++-2.95.2, I get:
| mururoa->/usr/local/bin/g++ -g -pg -ftemplate-depth-30 -fPIC -DPIC Test.C  
| Test.C: In function `int main(int, char **)':
| Test.C:13: implicit declaration of function `int time(...)'

Please, could fill in a bug-report and mark it as a regression?


| The crux of the problem seem to be (in fstream.tcc).
| 	  // XXX So that istream::getc() will only need to get 1 char,
| 	  // as opposed to BUF_SIZE.
| 	  if (__fd == 0)
| 	    _M_buf_size = 1;
| Consequently, characters are read one by one which is extremely 
| costly.
| Is this absolutely necessary (I cannot find support for this in the 
| standard, but my reading has been quick)???
| If yes, how can we avoid this behaviour for the read function: 


-- Gaby

More information about the Libstdc++ mailing list