Re: Read large ascii file quickly [message #74288 is a reply to message #74287] |
Fri, 07 January 2011 06:39   |
edward.s.meinel@aero.
Messages: 52 Registered: February 2005
|
Member |
|
|
On Jan 6, 4:39 pm, Paul Magdon <paulmag...@yahoo.de> wrote:
> Dear all,
> I have to read a large ascii file (2.5e+07 lines) into a 5000x5000 intarr. The code below works fine but it takes roughly 15-20min on my machine( not the oldest :) ). Any suggestions how to accelerate this?
>
> CODE:
>
> OPENR, unit, file, /GET_LUN
>
> result = INTARR(5000,5000, /NOZERO)
> count=0d
> WHILE (NOT EOF(unit)) DO BEGIN
> READF, unit, a,b,c,d,e,f
> print, count
> result(count) =FIX(f)
> count++
> ENDWHILE
>
> CLOSE, unit & FREE_LUN, unit
You could try all of the above suggestions; you could even use
READ_ASCII. But, there is no two ways about it -- reading ascii files
is slow. Always has been, always will be.
|
|
|