Confusion #2

 BBS: Inland Empire Archive
Date: 04-13-92 (17:42)             Number: 153
From: DON KROUSE                   Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Confusion #2                   Conf: (2) Quik_Bas
Continued from previous message.
String   --------- R O U T I N E ---------
Length   LOCATE/PRINT  PEEK/POKE     ASM     PRT/ASM POKE/ASM
      63     20.82031   28.83984   26.68750    78.02%  108.06%
      64     20.82031   29.37891   27.07031    76.91%  108.53%
      65     20.80859   29.77344   27.51953    75.61%  108.19%
      66     20.80859   30.21094   27.90234    74.58%  108.27%
      67     20.80859   30.71094   28.33984    73.43%  108.37%
      68     20.82031   31.14844   28.77734    72.35%  108.24%
      69     20.82031   31.58203   29.16016    71.40%  108.31%
      70     20.81250   32.07813   29.60938    70.29%  108.34%
      71     20.82031   32.51953   30.05078    69.28%  108.22%
      72     20.82031   32.96094   30.42969    68.42%  108.32%
      73     20.82031   33.39063   30.87109    67.44%  108.16%
      74     20.80859   33.88672   31.26172    66.56%  108.40%
      75     20.82031   34.33203   31.68750    65.71%  108.35%
      76     20.82031   34.76953   32.12891    64.80%  108.22%
      77     20.82031   35.21094   32.51172    64.04%  108.30%
      78     20.80859   35.69922   32.94922    63.15%  108.35%
      79     20.82031   36.19922   33.33984    62.45%  108.58%
      80     20.82031   36.57813   33.77734    61.64%  108.29%
   3,240     1,068.99   1,492.94   1,383.27    77.28%  107.93%
DECLARE SUB PrintFast (Rows%, Col%, msg$, atrib%)
DECLARE SUB FastPrint (Rows%, Col%, msg$, atrib%)
CLS
synch! = TIMER
DO: Beginning! = TIMER: LOOP WHILE Beginning! = TIMER
msg$ = "": loops% = 5000
OPEN "prtest2.txt" FOR OUTPUT AS #1
PRINT #1, "This is a speed test of 3 different screen printing routines."
PRINT #1, USING "The test does ###### loops of each routine."; loops%
PRINT #1,
PRINT #1, "String"
PRINT #1, "Length    LOCATE/PRINT    PEEK/POKE         ASM"
PRINT #1, "------    ------------    ---------      ---------"
PRINT #1,
FOR j% = 1 TO 80
msg$ = msg$ + "X"
synch! = TIMER
DO: start! = TIMER: LOOP WHILE start! = synch!
FOR i% = 1 TO loops%
   LOCATE 1, 1: COLOR 15, 1: PRINT msg$
NEXT i%
done! = TIMER
test3! = done! - start!
PRINT USING "LOCATE/PRINT time for #####, loops of length
## is ###.##### second
synch! = TIMER
DO: start! = TIMER: LOOP WHILE start! = synch!

FOR i% = 1 TO loops%
   PrintFast 1, 1, msg$, 31
NEXT i%
done! = TIMER
test1! = done! - start!
PRINT USING "PEEK/POKE time for #####, loops of length ##
is ###.##### seconds";
synch! = TIMER
DO: start! = TIMER: LOOP WHILE start! = synch!

FOR i% = 1 TO loops%
   FastPrint 1, 1, msg$, 31
NEXT i%
done! = TIMER
test2! = done! - start!
PRINT USING "ASSEBMLY time for #####, loops of length ## is
###.##### seconds";
PRINT #1, USING "  ##       ###.#####       ###.#####
###.#####"; j%; test3
BEEP
NEXT j%
PRINT #1,
ending! = TIMER
TotalTime! = ending! - Beginning!
PRINT #1, USING " The test took ##########,.## seconds."; TotalTime!
CLOSE #1
BEEP: BEEP: BEEP: BEEP: BEEP
DEFINT A-Z
SUB PrintFast (Rows%, Col%, msg$, atrib%)
place% = ((((Rows - 1) * 80) + Col) - 1) * 2
DEF SEG = &HB800
FOR i = 1 TO LEN(msg$)
   POKE place%, ASC(MID$(msg$, i, 1))
   POKE place% + 1, atrib
   place% = place% + 2
NEXT i
DEF SEG
END SUB
---
 * Origin: Silver Lake Systems * Bothell, WA (1:343/58)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET