logo       

Re: fscanf performance > 10x slower in 2.1.69 compared to 2.1.50 on Windows: msg#00016

gnu.octave.bugs

Subject: Re: fscanf performance > 10x slower in 2.1.69 compared to 2.1.50 on Windows


----- Original Message -----
From: "John W. Eaton" <jwe@xxxxxxxxxxxxxxxxx>
To: "Wlmsears Comcast" <wlmsears@xxxxxxxxxxx>
Cc: <bugs@xxxxxxxxxx>
Sent: Tuesday, April 12, 2005 11:55 AM
Subject: Re: fscanf performance > 10x slower in 2.1.69 compared to 2.1.50 on
Windows

< older messages deleted >


> With this solution, what happens to the file position after reading
> a file
>
> 123 abc
>
> ? I would expect to be able to read a file like this with
>
> number = fscanf (f, "%f");
> text = fscanf (f, "%s");
>
> and have number = 123 and text = "abc". It seems that the code above
> would read the 123 set failbit and skip the part containing "abc".
>
> If the slowdown is in the C++ class that implements the stream
> extractor for double precision numbers, then perhaps the best place to
> report the problem is to the libstdc++ maintainers?
>
> jwe
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>

John,

123 abc

is parsed as 123 and "abc", you expected. However,

123abc

will be parsed as 123 (with the abc being silently ignored). The earlier
version of octave parsed it as 123 followed by "abc". The
C++ extractors do as well. I presume this is a feature, though I would prefer
it if the number of tokens matched was "wc" would
report, but doubt this would really matter for any practical data.

I agree this is best handled by fixing the g++ libraries. The problem exists
in 3.4.2 for Mingw as well as in 3.3.3 for cygwin, so
the problem is not cygwin specific. I needed a fix for octave quickly, and
discovered that there was already a template
specialization that I could modify. My problem is under control now with the
existing fix, but if anyone cares, I could modify it to
restore
the old behavior for "123abc" and the like.

Bill



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise