Re: Read large ascii file quickly [message #74291 is a reply to message #74290] |
Fri, 07 January 2011 02:29   |
MC
Messages: 50 Registered: September 1996
|
Member |
|
|
On Jan 7, 11:54 am, Paul Magdon <paulmag...@yahoo.de> wrote:
> Dear all,
> I print the counter just to make sure something is working.
>
> Here are a couple of lines of the ascii:
>
> 0.050249,0.058117,0.029660,0.097091,0.358593,1
> 0.051483,0.061990,0.030229,0.095512,0.371539,1
> 0.055431,0.062700,0.031565,0.090342,0.382935,1
>
>
>
>> Well noted. I imagine nobody is going to read the 25 million numbers
>> printed on the screen. The most efficient way to read the file will
>> probably not use a loop anyway.
>
> Yes, I would love to see another option without a loop but I don't know any
> Cheers Paul
Printing the counter may be the slowest step Comment that out. Also, I
think you can read the data in one go into a single big array -so no
loop needed as EOF stops the read with an error message -you can then
catch the EOF error generated. Sort of an ugly way of doing it but it
might be faster than looping
Cheers MC
|
|
|