READ$/Data Slow
#1
I have some data that I want to keep embedded in the code instead of an external file.  This takes about 4 seconds to execute (the routines formatStarRA, formatStarDec and J2000Topo only account for about 0.3 seconds).  I could make each line (element) one string padding with spaces and then using mid$ to parse it out. That would be 2400 READ$ instead of 2400*11.   Any other suggestions to speed this up? 




FUNCTION DoubleStarLoad AS LONG
    LOCAL t AS LONG
    LOCAL tempRA, TempDec AS DOUBLE, dummy AS STRING

    FOR t= 0 TO 2399
        DoubleStarData(t).CST=READ$((t)*11+1)
        DoubleStarData(t).ObjName=READ$((t)*11+2)
        DoubleStarData(t).SAO=READ$((t)*11+3)
        tempRA=formatStarRA(READ$((t)*11+4))
        tempDec=formatStarDec(READ$((t)*11+5))
        J2000Topo(tempRA,tempDec)
        DoubleStarData(t).RA=tempRA
        DoubleStarData(t).Dec=tempDec
        DoubleStarData(t).Magnitude1=READ$(t*11+6)
        DoubleStarData(t).Magnitude2=READ$(t*11+7)
        DoubleStarData(t).Spectral=READ$(t*11+9)
        DoubleStarData(t).Distance=VAL(READ$(t*11+10))
        DoubleStarData(t).Separation=READ$(t*11+11)
    NEXT t

    DATA "Aqr","1 Aqr","126062","20:39:25","+00:29:11","5.27","12.3","7.03","K0III","71.48","65"
    DATA "Ari","1 Ari","74966","01:49:50","+22:15:45","16","17","1","M3.7+M4.2","","17.5"
    DATA "Ari","1 Ari","74966","01:50:09","+22:16:30","6.33","7.21","0.88","G3III","179.53","2.9"
    DATA "Boo","1 Boo","82942","13:40:40","+19:57:20","5.76","9.6","3.84","A1V","100.6","4.4"
    DATA "Cam","1 Cam","24672","04:32:02","+53:54:39","5.78","6.82","1.04","B0III","217.39","10.4"
    DATA "Del","1 Del","106172","20:30:18","+10:53:45","6.2","8.02","1.82","Be+B","227.79","0.9"
    DATA "Dra","1 Dra","15532","11:31:07","+69:24:00","14.3","14.8","0.5","","","1.2"
    ....

END FUNCTION
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)