home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / datamage.zip / DOCS.ZIP / SPEED.DOC < prev    next >
Text File  |  1991-07-06  |  12KB  |  200 lines

  1. The DATAMAGE data management system:  Comments on execution speed.
  2.  
  3. Speed  of  execution  is  a topic of interest  in  any  program  that  performs
  4. significant tasks.  Databases can be said to live or die by their ability to do
  5. MASSIVE  processing  in  literally no time flat.  Many  of  the  programs  that
  6. compete  with  DATAMAGE  waste incredible amounts of  disk  space  and  include
  7. methods that render their files and indexes unimpregnable to any other  program
  8. in order to accomplish, or to SEEM to accomplish, this impossible goal.
  9.  
  10. There  are ways to speed things up, and it is the purpose of this  document  to
  11. explain  them.   These methods fall into three basic categories:   Get  a  fast
  12. computer,  use the computer's memory instead of the disk drive, and  keep  your
  13. files all in one place on the disk drive.
  14.  
  15. HARDWARE:
  16.  
  17. Certainly,  the  raw  power  of  the target  computer  is  a  very  significant
  18. ingredient  in  the  equation.   If  you are using an  old  PC  or  PCXT  whose
  19. microprocessor is the original 8088 and runs at 4.77 Mhz you will be quite dis-
  20. satisfied  with the performance of this, or any other program.  (A Mhz, by  the
  21. way,  is  one million clock cycles per second.)  If you can not  afford  better
  22. hardware one thing that will enhance your current computer is to pull the  8088
  23. chip  out  and  replace  it with a NEC V-20.   This  will  almost  double  your
  24. processing speed but your computer will still be, in modern terms, VERY SLOW.
  25.  
  26. The  original PCAT, running at 6 Mhz, and the later "enhanced" version of  same
  27. running  at 8 Mhz were fast machines in their day.  Their time has  passed.   A
  28. modern  AT-class  machine should run at a minimum of 12 Mhz,  and  hardware  is
  29. available  that  runs  all  the way up to 44 Mhz!   There  is  little,  if  any
  30. difference  between  an 80286, 80386 or even the latest  80486  microprocessors
  31. when  shuffling  datafiles.  The CLOCK rules the computer,  and  dictates  it's
  32. speed.  No other enhancement can approach the clock speed for doing it fast.
  33.  
  34. SUBSTITUTING MEMORY FOR THE DISK DRIVE:
  35.  
  36. Memory  above MS-DOS's 1,024,000 byte (1 MEGABYTE) limit is available  ONLY  on
  37. AT-class machines, or with special E.E.M.S cards on XT-class machines.   MS-DOS
  38. can not use this memory, but your computer can make use of it via DRIVERS which
  39. switch  the microprocessor into it's native mode, make use of the memory,  then
  40. switch  it  back into 8088 emulation mode and continue to execute  the  program
  41. that  runs  under  MS-DOS.  That's right - when you  are  running  MS-DOS  your
  42. microprocessor,  be  it  a '286, '386 or '486, is NOT  running  it's  potential
  43. instruction  set, but is emulating an 8088.  The newer microprocessors CAN  NOT
  44. run MS-DOS, nor can MS-DOS access or manage memory over 1 megabyte.
  45.  
  46. There  are two types of drivers that can add significant speed to DATAMAGE,  or
  47. any other program that makes heavy usage of the disk drive:  RAM-DISKS and DISK
  48. CACHETING.  These drivers allow the computer to use memory above the 1 megabyte
  49. limit and substitute it for the slower disk drives.
  50.  
  51. With the RAM DISKS a "fake" disk drive is added to your computer.  You can  use
  52. it  just as you would any real drive, you can do everything except  remove  and
  53. replace  the disk, which is also not possible with a hard disk.  DATAMAGE  will
  54. prompt you for the disk drive to use for various tasks.  If you have sufficient
  55. memory you can set up a ram-disk and greatly profit in terms of speed.
  56.  
  57. With  the DISK CACHETING drivers the data in the files currently open  on  your
  58. computer is read from the disk where it resides and moved into memory above the
  59. 1 megabyte limit.  When you read or write data it is moved from/to this  memory
  60. which takes quite a bit less time than doing the same operation from the disk.
  61.  
  62. BENCH MARKS:
  63.  
  64. Before beginning it may be helpful to explain that the standard benchmark of PC
  65. execution  speed  has become Peter Norton's SYSINFO program.   The  version  of
  66. SYSINFO  used for these illustrations was 3.0.  This program assigns a  numeric
  67. rating to the computer tested, 1.0 being the speed of a standard PC running  an
  68. 8088 at 4.77 Mhz.  So, 1.0 is DEAD SLOW.
  69.  
  70. In  order  to  demonstrate just how much speed can be  gained  by  the  various
  71. methods  detailed  above here are some operations, done with and  without  disk
  72. cacheting  and  at  different clock speeds.  They were all  done  on  the  same
  73. computer,  a  CHIPSET  (NEAT) '286 running at 10 or 20 Mhz.   This  machine  is
  74. certainly not the fastest computer that money can buy, but it aint too shabby.
  75.  
  76. This machine consistently attains SYSINFO ratings of 11.5 or 15.5 (depending on
  77. external  or internal bus timing) at it's 10 Mhz speed and 23.0 at it's 20  Mhz
  78. speed.   There are utilities that will slow a computer down in order to play  a
  79. video  game  designed  for  the  older,  slower  hardware.   Such  a   program:
  80. VARISLOW.EXE was used to decrease the speed of the computer used for testing as
  81. much as possible, to 3.6 or 4.0 SYSINFO rating.
  82.  
  83. Of  the many operations that can be done by DATAMAGE, sorting the records  into
  84. order  is  the most demanding and time-consuming.  The sorts  were,  therefore,
  85. used  for  the  benchmark tests.  The datafile used for the  bench  mark  tests
  86. comprises  3,332 records. The size of this file after it was converted  to  the
  87. DATAMAGE format (DATAMAGE also found and rejected all the duplicate records  it
  88. contained during the conversion!) is 2,050,512 bytes.  It was imported from the
  89. dBase  format, and is distributed with the SHAREWARE MARKETING SYSTEM from  Jim
  90. Hood.  Thanks, Jim!
  91.  
  92. HARDWARE:
  93.  
  94. For  the hardware test the records were first arranged into an order  that  was
  95. the same for each test, and completely random in terms of the desired order  on
  96. RECORD  NUMBERS.  The record numbers are in the computer's memory, so the  disk
  97. drive was not accessed.
  98.  
  99. SI RATE   1ST 1,000      2ND 1000       3RD 1000       TIME
  100. ===========================================================
  101. 3.6            1:15           3:20           5:25     12:11
  102. 15.5            :23           1:00           2:23      3:09
  103. 23.0            :14            :36            :58      2:11
  104.  
  105. As you can see, the few extra dollars spent to procure a modern, fast  computer
  106. PAY OFF!  As I have learned, long ago: There's NO economy in buying junk!   And
  107. there  is no point of reference that will demonstrate this axiom  more  clearly
  108. and frequently than computer hardware.
  109.  
  110. HARDWARE and DISK CACHETING:
  111.  
  112. Even  more  difficult  than the sorting of numbers already  in  the  computer's
  113. memory is the sorting of string data.  This must be gotten from the disk  drive
  114. as the sort progresses, and takes far longer to compare than numeric data.
  115.  
  116. The same file contains a string field: COMPANY NAME.  The file was arranged  in
  117. an  order that placed the company name at as near as you could come  to  random
  118. intervals within the file, then sorted into alpha order.  As I watched the sort
  119. progress I realized that each and every record was moved.
  120.  
  121. DBASE AND SORTING ALPHA:
  122.  
  123. While  completing this portion of the documentation I asked a young friend  who
  124. has,  like  a lot of other people, been FAKED OUT by dBase, how long  it  would
  125. take the industry standard to complete this task.  I pointed him to the file in
  126. dBase format, and he got right back to me and, with swollen chest and in a VERY
  127. loud voice, informed me that dBase did this in less than a minute.
  128.  
  129. I KNEW BETTER!
  130.  
  131. So,  I  went  over  there and asked him to do it for me.   He  gave  dBase  the
  132. commands and it did SOMETHING in less than a minute.  What it did was to create
  133. a whopping 355K b-tree file containing the data in the company name field.   It
  134. did NOT sort the records nor, apparently, is it able to do so!
  135.  
  136. As  we  attempted  to USE this index we noticed that, while  getting  the  next
  137. record  in  the  order, there was a delay.  This time was  spent  by  dBase  in
  138. climbing it's b-tree in order to FIND said record.
  139.  
  140. DATAMAGE,  on the other hand, produced a MARKER file of only a little over  6K.
  141. The  reading of the next record in the order was INSTANTANEOUS, as  the  MARKER
  142. file  contained  it's  location  in the file.  DATAMAGE did  ALL  of  the  work
  143. involved  in the sort at one time.  You could use the results of this work  for
  144. the  next thousand years and not have to wait one additional nanosecond to  see
  145. your records in the desired order.
  146.  
  147. In  the immortal words of one Laut Su (Chinese profit crica 1,000 A.D.):   "The
  148. foremost  thoughts in a wise man's mind are these:  THINGS ARE SELDOM  AS  THEY
  149. SEEM!"   Maybe  there is a program that will do a REAL alpha-sort  faster  than
  150. DATAMAGE.   Be that as it may, I will NOT lie or cheat to make my program  SEEM
  151. faster than it is.  But soon, maybe next year, I will re-write the BASE program
  152. in C, and thereby honestly increase it's speed.
  153.  
  154. HONEST TIMES TO SORT THE DATA:
  155.  
  156. With  these times the speed of access to data on disk becomes a very  important
  157. factor,  and disk cacheting begins to have great value.  The  proceeding  table
  158. relates the computer's speed as well as the presence of cacheting.
  159.  
  160. NORTON     BYTES   1ST  RECORDS   2ND  RECORDS   3RD  RECORDS   TOTAL  RECORDS
  161. SI RATE   CACHET  1000  SECOND   1000  SECOND   1000  SECOND     TIME  SECOND
  162. ==============================================================================
  163. 4.0            0 20:14     .78  29:53     .55  33:26     .50  1:37:14     .57
  164. 11.5           0 11:30    1.45  15:45    1.01  17:15     .97    50:13    1.10
  165. 11.5        1024  7:35    2.20   9:01    1.85  10:29    1.59    30:40    1.81
  166. 23.0           0  9:02    1.83  12.20    1.35  13:17    1.41    39:15    1.41
  167. 23.0        1024  5:08    3.25   5:29    3.03   7:23    2.26    18:07    3.07
  168.  
  169. You  are  quite  likely more mathematically reclined than  myself.   Hoards  of
  170. numeric data could be extrapolated from the above - have fun!  Just one  point:
  171. If  you  have a computer that actually rates 4.0 on SYSINFO you will  be  hard-
  172. pressed  to match the first line.  Though the time wasting utility  slowed  the
  173. microprocessor down this machine STILL communicates with a drive that's 3 times
  174. as fast as the drive that came with the original PC or XT, down a 16-bit bus.
  175.  
  176. The point should be made, here, that DATAMAGE can, and usually will, sort  your
  177. datafile  MUCH faster than this.  Look at the times above as sort of  a  worst-
  178. case scenario.  See the file MAIN.DOC, under the heading F-10, MARKER FILE  and
  179. the sub-heading RESTORE REMAINING RECORDS to discover how to get your work done
  180. fast.   You will only need to sort the raw order ONCE, after that  you'll  make
  181. much better time via the use of a MARKER FILE.
  182.  
  183. KEEPING THE FILES TOGETHER - FRAGMENTATION:
  184.  
  185. As  DATAMAGE  files  grow  your disk drive is bound  to  get  FRAGMENTED.   The
  186. datafiles  will grow piece by piece.  You have a DATAMAGE file that is 100K  in
  187. length; you enter several documents with your word processor, download a couple
  188. hundred  Kbytes with your modem, then add some records to your  DATAMAGE  file.
  189. All the things that happened in between will BE in between on your disk  drive,
  190. resulting in DATAMAGE having to hunt all over the drive to read the file.
  191.  
  192. There  are utilities galore to defragment hard disks.  Two GOOD ones  that  are
  193. available  as  SHAREWARE  from  your disk vendor or on  a  local  BBS  are  DOG
  194. (DiskOrGanizer)  and  SST.  DOG is really safe, but also kinda  slow.   SST  is
  195. really fast but, should your power fail during the session, bye bye disk!
  196.  
  197. Commercial  programs such as NORTON UTILITIES also include  defragmentation  in
  198. their  bag  of tricks.  Whatever your choice of vehicle you  should  defragment
  199. your  hard disk AT LEAST once a month, and for heavy usage once a week.   Doing
  200. so will have you working more and waiting less.