home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / dos / batchfil.lzh / _PERFORM.REM < prev    next >
Text File  |  1983-08-25  |  3KB  |  44 lines

  1.  
  2.  
  3.                              Text File _perform.rem
  4.  
  5.  
  6. Are you running this Batch File from a hard disk or an "electronic" or "RAM"
  7. disk?  If not, then the first performance improvement that you might make (to
  8. your entire system!) is to obtain "electronic disk" software and enough memory
  9. to support it.  The dramatic improvement in the performance of your system will
  10. more than compensate for the bucks spent.  Batch Files are extremely "disk
  11. bound", meaning that the disk is accessed for almost every command line
  12. (comments are buffered somewhat), and an electronic disk will eliminate the
  13. annoying "crank! crank!" of the floppy drive grinding through each line of the
  14. Batch File.  For any serious work on the PC, be it user applications or program
  15. development, electronic disk software is indispensable; once hooked on this
  16. high-performance addition to your PC, you won't understand how you survived
  17. without it. (If you must run on floppies, try to locate Batch Files as the
  18. first files on the diskette; this will noticably reduce seek time).
  19.  
  20. Well, that was an expensive piece of editorial advice!  What can we do for FREE
  21. to further improve Batch File performance?  One improvement is just what we are
  22. doing here: putting long-winded comments into text files instead of into Batch
  23. File comment lines.  There is an important reason for keeping the size of Batch
  24. Files as small as possible and still get the job done.  The Batch File
  25. processor is a text interpreter.  One unfortunate consequence of this is that
  26. each time the processor encounters a "goto :label" subcommand, it starts at the
  27. top of our Batch File and searches, line by line, for the statement that
  28. contains the text ":label", the destination of the "goto" jump.  On short Batch
  29. Files, there is no discernible penalty for this linear search for the label.
  30. But in longer Batch Files, the time penalty for finding labels near the bottom
  31. of the file can be long and irritating.  Displaying text out of text files
  32. instead of Batch File comment lines is one way to cut down the file size;
  33. another way is to design a large Batch File function as a series of small Batch
  34. Files that "call" each other.  This kind of modular programming (and that's
  35. what Batch Files are, command line programs!) helps us to create Batch Files
  36. that are easy to develop, debug, understand, and maintain.  We'll show examples
  37. of this further on.
  38.  
  39. This does not mean that we should avoid visible comments completely.  When we
  40. do display short visible comments, there are some tricks to make them compact
  41. and readable.  Let's end this text file and go back to the Batch File
  42. execution, and look at some examples of comments.
  43.