READ$/Data Slow
#3
Lots of multiplying by 11. try this:

((this text belongs below the code. See Reason for edit.))
You said "... (the routines formatStarRA, formatStarDec and J2000Topo
only account for about 0.3 seconds).
0.3 seconds may become significant with all *11 gone.
If those functions are only called from DoubleStarLoad, then put their code as GOSUBs within DoubleStarLoad.

Code:
function DoubleStarLoad as long
    local t as long
    local tempRA, TempDec as double, dummy as string

    for t= 0 to 26399 step 11
        DoubleStarData(t).CST=read$(t+1)
        DoubleStarData(t).ObjName=read$(t+2)
        DoubleStarData(t).SAO=read$(t+3)
        tempRA=formatStarRA(read$(t+4)
        tempDec=formatStarDec(read$(t+5)
        J2000Topo(tempRA,tempDec)
        DoubleStarData(t).RA=tempRA
        DoubleStarData(t).Dec=tempDec
        DoubleStarData(t).Magnitude1=read$(t+6)
        DoubleStarData(t).Magnitude2=read$(t+7)
        DoubleStarData(t).Spectral=read$(t+9)
        DoubleStarData(t).Distance=val(read$(t+10)
        DoubleStarData(t).Separation=read$(t+11)
    next t
    'I don't repeat the DATA here.
end function                   

Posted while I was working: " I reformatted the data to one string per line with a fixed length for each element. Much faster - I suppose 11x faster."

You got rid of the *11 another way.
GOSUB suggestion still stands if they're only called from here.

Cheers,
Reply


Messages In This Thread
READ$/Data Slow - by Brent F Boshart - 11.10.2025, 12:55 AM
RE: READ$/Data Slow - by Brent F Boshart - 11.10.2025, 03:32 AM
RE: READ$/Data Slow - by Dale Yarker - 11.10.2025, 04:06 AM
RE: READ$/Data Slow - by Stuart McLachlan - 11.10.2025, 04:49 AM
RE: READ$/Data Slow - by Brent F Boshart - 11.10.2025, 09:13 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)