READS, input, struct vs. READS, input, var1,var2, etc. [message #50004] |
Thu, 07 September 2006 14:05 |
Pete Warner
Messages: 14 Registered: July 2006
|
Junior Member |
|
|
I've been reading large ascii text files into IDL and discovered a huge
difference in run time when using READS and structures versus READS and
other variables. What is going on?
The slow way:
struct = {teststruct, var1:0, var2:0.0, str1:''}
reads, linefromfile, struct, format='(I2, F10.3, A0)'
Somehow way faster:
var1=0
var2=0.0
str1=''
reads, linefromfile, var1, var2, str1, format='(I2, F10.3, A0)'
struct = {teststruct, var1:var1, var2:var2, str1:str1}
Could someone explain why the first way is so slow? It is quite
noticible in my program, running in 2.7 seconds the first way and
0.125s the second. The actual lines I'm reading are much longer than
the examples above. Anything that could help me avoid similar problems
would be great.
|
|
|