home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
drdobbs
/
1988
/
07
/
bench
/
benchnew.tb
< prev
next >
Wrap
Text File
|
1988-04-29
|
2KB
|
85 lines
[FILENAME: BENCHNEW.TB]
DEFLNG A-Z
DIM t!(28)
OPEN "c:tbnew.tim" FOR OUTPUT AS #1
'time for a raw long integer loop, executed 1,000,000 times.
t! = TIMER
FOR i = 1 TO 1000
FOR j = 1 TO 10
NEXT j
NEXT i
t!(0) = TIMER - t!
'time for 1,000,000 long integer assignments.
y = 5: z = -5
t! = TIMER
FOR i = 1 TO 1000
FOR j = 1 TO 10
x = y
x = z
NEXT j
NEXT i
t!(1) = (TIMER - t! - t!(0)) / 2
'time for 1,000,000 long integer adds
t! = TIMER
FOR i = 1 TO 1000
FOR j = 1 TO 10
x = x + y
NEXT j
NEXT i
t!(2) = TIMER - t! - t!(1)
'time for 1,000,000 long integer subtracts
x = 0
t! = TIMER
FOR i = 1 TO 1000
FOR j = 1 TO 10
x = x - y
NEXT j
NEXT i
t!(3) = TIMER - t! - t!(1)
'time for 1,000,000 long integer multiplies
t! = TIMER
FOR i = 1 TO 1000
FOR j = 1 TO 10
x = i * j
NEXT j
NEXT i
t!(4) = TIMER - t! - t!(1)
'time for 1,000,000 long integer divides
t! = TIMER
FOR i = 1 TO 1000
FOR j = 1 TO 10
x = i \ j
NEXT j
NEXT i
t!(5) = TIMER - t! - t!(1)
'following are logical comparisons and operators
'time for 1,000,000 long integer comparisons
x = 5: y = -5
t! = TIMER
FOR i = 1 TO 1000
FOR j = 1 TO 10
IF i < y THEN x = 1
NEXT j
NEXT i
t!(23) = TIMER - t! - t!(0)
'print results of benchmark
PRINT #1, "Raw long integer loop, 1,000,000 iterations:"; TAB(45); t!(0)*100
PRINT #1, "1,000,000 long integer assignments:"; TAB(45); t!(1)*100
PRINT #1, "1,000,000 long integer additions:"; TAB(45); t!(2)*100
PRINT #1, "1,000,000 long integer subtractions:"; TAB(45); t!(3)*100
PRINT #1, "1,000,000 long integer multiplications:"; TAB(45); t!(4)*100
PRINT #1, "1,000,000 long integer divisions:"; TAB(45); t!(5)*100
PRINT #1, "1,000,000 long integer comparisons:"; TAB(45); t!(23)*100
END