comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: slow file-handling
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: slow file-handling [message #6913] Tue, 03 September 1996 00:00 Go to previous message
Marty Ryba is currently offline  Marty Ryba
Messages: 16
Registered: May 1996
Junior Member
In article <322ABD58.3F93@ic.ac.uk>, Jorn Helbert <jorn@ic.ac.uk> writes:
|> line by line it takes nearly ten minutes on a sparc twenty. my read
|> block is the following
|> b_temp = double([0.,0.,0.])
|> t_temp = [0.0]
|> WHILE NOT eof(u1) DO BEGIN
|> readf,u1,t_temp,foo,foo,foo,b_temp
|> t_u = [t_u,t_temp]
|> b_u = [b_u,b_temp]
|> END

You may be getting slowed by all the reallocation. You will also
get horrendous memory fragmentation. Do this:

t_u = fltarr(50)
b_u = dblarr(50,3)
npts = 0L
cursize = 50L
b_temp = dblarr(3)
t_temp = 0.0
WHILE NOT eof(u1) DO BEGIN
readf,u1,t_temp,foo,foo,foo,b_temp
t_u(npts) = t_temp
b_u(npts,*) = b_temp
npts = npts + 1L
IF npts EQ cursize THEN BEGIN
t_u = [temporary(t_u), fltarr(50)]
b_u = [temporary(b_u), dblarr(50,3)]
cursize = cursize + 50L
ENDIF
ENDWHILE

t_u = (temporary(t_u))(0:npts-1L)
b_u = (temporary(b_u))(0:npts-1L,*)

I generally use 50 as a block size, but you could go larger.

--
Dr. Marty Ryba | Of course nothing I say here is official
MIT Lincoln Laboratory | policy, and Laboratory affililaton is
ryba@ll.mit.edu | for identification purposes only,
| blah, blah, blah, ...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: passing parameters indirectly
Next Topic: IDL Triangulate/TriGrid >>> Wave 6.0 ?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 05:00:09 PDT 2025

Total time taken to generate the page: 1.68466 seconds