home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / bp_6_93 / bonus / winer / bench.bas < prev    next >
BASIC Source File  |  1992-05-12  |  794b  |  41 lines

  1. '********** BENCH.BAS - simple benchmark program example
  2.  
  3. 'Copyright (c) 1992 Ethan Winer
  4.  
  5. DEFINT A-Z
  6. CLS
  7.  
  8. X$ = STRING$(80, "X")   'create the test string
  9. Y$ = STRING$(80, "Y")
  10. Z$ = STRING$(80, "Z")
  11.  
  12.  
  13. Synch! = TIMER          'synchronize to the system timer
  14. DO
  15.   Start! = TIMER
  16. LOOP WHILE Start! = Synch!
  17.  
  18. FOR X = 1 TO 1000       '1000 times is sufficient
  19.   LOCATE 1
  20.   PRINT X$; Y$; Z$
  21. NEXT
  22.  
  23. Done! = TIMER           'calculate elapsed time
  24. Test1! = Done! - Start!
  25.  
  26. Synch! = TIMER          'as above
  27. DO
  28.   Start! = TIMER
  29. LOOP WHILE Start! = Synch!
  30.  
  31. FOR X = 1 TO 1000
  32.   LOCATE 1
  33.   PRINT X$ + Y$ + Z$
  34. NEXT
  35.  
  36. Done! = TIMER
  37. Test2! = Done! - Start!
  38.  
  39. PRINT USING "##.## seconds using three strings"; Test1!
  40. PRINT USING "##.## seconds using concatenation"; Test2!
  41.