PSN-L Email List Message

Subject: Re: Basic Programming Help desired?
From: "Geoff" gmvoeth@...........
Date: Thu, 8 May 2008 11:17:28 -0700


Hello ian,

Yes, Straight Line Code is almost always
faster then is using subroutines or jumps.
I notice here your math is all shift and adds
Which is in reality all any digital computer does.
When you tell a CPU to multiply or divide
it only shifts right or left and adds
positive or negative numbers. Some decimal numbers
can never exactly be reproduced in binary form
so there will most times be rounding errors.
To reduce the rounding errors the business community
dealing in money likes to use BCD " binary coded decimal"
TRY to match exactly decimal 0.1 in binary numbers.
Sort of like PI it seems to have no end.
I wonder out loud here if PI has a number system
base whatever that will come out with an end to it.

Straight line code is terribly lengthy but the fastest
way to go. That is basically what you say here as well
as stick to binary math whenever possible.

When saving to disk other things need to be considered
like exactly how the controller microcode works
or handles data and what will be fastest for transfer of data.
I have noticed great differences in speed of various programs.

The fastest save program I have ever seen relates to a
program called SPOTMAU and backs up your system via DOS
to an image file in whatever partition It will save at up to
900MB per Minute using FAT32 Drives. That is still much slower
then an ATA100 is capable of moving data. I get the feeling that
data is written several times over to the same location
or things would be much faster than they are.

My original question deals more with what technique
will save a numerical array fastest to the hard disk drive.
Id like to get 100MB/sec which I understand an ATA100 IDE
controller & HDD can handle.

Best Regards;
geoff

----- Original Message ----- 
From: "ian" 
To: 
Sent: Tuesday, May 06, 2008 10:32 AM
Subject: Re: Basic Programming Help desired?


> Hi,
> 
> I'm not familiar with this flavour of basic but 2 comments:
> 
> Is the for loop meant to be 0 to 32769?  Normally it would be 32767 for 
> 15 bits - I don't know the application for this code. 
> 
> When coding loops, I found it better (runs faster) to repeat the code in 
> the loop and reduce the number of times around the loop, 16 being 
> optimum.  For example:
> 
> FOR A = 0 to 2047
>    DATA_1?(A*16 + 0) = ( 65 + (A*16 + 0) MOD 58 )
>    DATA_1?(A*16 + 1) = ( 65 + (A*16 + 1) MOD 58 )
>    DATA_1?(A*16 + 2) = ( 65 + (A*16 + 2) MOD 58 )
>    DATA_1?(A*16 + 3) = ( 65 + (A*16 + 3) MOD 58 )
>    DATA_1?(A*16 + 4) = ( 65 + (A*16 + 4) MOD 58 )
>    DATA_1?(A*16 + 5) = ( 65 + (A*16 + 5) MOD 58 )
>    DATA_1?(A*16 + 6) = ( 65 + (A*16 + 6) MOD 58 )
>    DATA_1?(A*16 + 7) = ( 65 + (A*16 + 7) MOD 58 )
>    DATA_1?(A*16 + 8) = ( 65 + (A*16 + 8) MOD 58 )
>    DATA_1?(A*16 + 9) = ( 65 + (A*16 + 9) MOD 58 )
>    DATA_1?(A*16 + 10) = ( 65 + (A*16 + 10) MOD 58 )
>    DATA_1?(A*16 + 11) = ( 65 + (A*16 + 11) MOD 58 )
>    DATA_1?(A*16 + 12) = ( 65 + (A*16 + 12) MOD 58 )
>    DATA_1?(A*16 + 13) = ( 65 + (A*16 + 13) MOD 58 )
>    DATA_1?(A*16 + 14) = ( 65 + (A*16 + 14) MOD 58 )
>    DATA_1?(A*16 + 15) = ( 65 + (A*16 + 15) MOD 58 )
> NEXT A
>    DATA_1?(32768) = ( 65 + 32768 MOD 58 )
>    DATA_1?(32769) = ( 65 + 32769 MOD 58 )
> 
> This isn't debugged or known to be syntactically correct.  Might be 
> worth trying though...
> 
> Ian
> 
> Geoff wrote:
>> The Following Results Found;
>>
>> I changed VIRTUAL Array to HUGE
>> which I belive keeps everything
>> below the DOS 1MB RAM boundary
>> and then used a RANDOM instead of a
>> BINARY OPEN command. It seems RANDOM
>> is best for numbers and BINARY
>> is best for Strings if you want to
>> do things byte by byte in PowerBasic For DOS.
>> EVERYTHING now becomes;
>>
>> $LIB COM        ON
>> $LIB FULLFLOAT  ON
>> $LIB VGA        ON
>> $ERROR BOUNDS   ON
>> $ERROR NUMERIC  ON
>> $ERROR OVERFLOW ON
>> $ERROR STACK    ON
>> $CPU 80386
>> $COM    1024
>> $STRING 32
>> $STACK  2048
>> $SOUND  256
>> $DYNAMIC
>> $COMPILE EXE "TEST.EXE"
>> $FLOAT NPX
>> $OPTIMIZE SPEED
>> $EVENT
>> $OPTION CNTLBREAK ON
>>
>> DIM HUGE DATA_1?(0:32769)
>> FOR A = 0 to 32769 : DATA_1?(A) = ( 65 + A MOD 58 ) : NEXT A
>> FILE1$ = "c:\data\test.dat"
>> START1 = TIMER
>> OPEN FILE1$ FOR RANDOM AS #1 LEN = 1
>> FOR A?? = 0 to 32769
>> PUT #1,A?? + 1,DATA_1?(A??)
>> NEXT A??
>> CLOSE
>> STOP1 = TIMER
>> IF START1 > STOP1 THEN START1 = START1 + 86400
>> PRINT "FILE CREATION RUNTIME :"; ROUND(( STOP1 - START1 ) , 3 )
>> ' KILL FILE1$
>> SLEEP 3
>> END
>>
>> Best regards
>> geoff
>>
>> __________________________________________________________
>>
>> Public Seismic Network Mailing List (PSN-L)
>>
>> To leave this list email PSN-L-REQUEST@.............. with the body of 
>> the message (first line only): unsubscribe
>> See http://www.seismicnet.com/maillist.html for more information.
>>
>>
> __________________________________________________________
> 
> Public Seismic Network Mailing List (PSN-L)
> 
> To leave this list email PSN-L-REQUEST@.............. with 
> the body of the message (first line only): unsubscribe
> See http://www.seismicnet.com/maillist.html for more information.
__________________________________________________________

Public Seismic Network Mailing List (PSN-L)


[ Top ] [ Back ] [ Home Page ]