[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Why is sscanf() so slow?

**From**: |
stefan |

**Subject**: |
Why is sscanf() so slow? |

**Date**: |
Sat, 25 Jan 2003 14:45:39 -0600 |

Dear Octaver's,
first of all: Thanks for great software. I am using it now for about two
years, especialy for displaying and adjusting measured data (comes from
some measurement bus system to computer). The software which drives these
devices almostly always produce tab- or comma-seperated data.
For this I do:
while (isstr(line = fgets(fid)))
if (index(line, "#") == 1)
continue;
endif
if (length(line) <= 2)
continue;
endif
numbers = sscanf(line, "%g %g %g %g %g %g %g %g", 8);
for i = 1 : length(numbers)
values(n, i) = numbers(i);
endfor
n = n + 1;
endwhile
or very likely...
For more than 1000 lines this takes *ages*. Is there a better way to do
so or is it a slow implementation in octave? I would like to see this
improved some day.
For now I do 'save -mat-binary %s values' to keep loading times short next
time. Some cache algo around the above code.
Any help is appreciated,
address@hidden
-------------------------------------------------------------
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
-------------------------------------------------------------

**Why is sscanf() so slow?**,
*stefan* **<=**