Re: Read large ascii file quickly [message #74301 is a reply to message #74300] |
Thu, 06 January 2011 13:53  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jan 6, 7: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
Just from that it is hard to say. How is the file organized (can you
show a few lines of it)? What are the types of a,b,c,d,e,f?
Just as a side note, if you use free_lun, the call to close is
unnecessary. free_lun closes the unit if it is open.
|
|
|