home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / hypercar / 4110 < prev    next >
Encoding:
Text File  |  1992-11-08  |  7.7 KB  |  174 lines

  1. Newsgroups: comp.sys.mac.hypercard
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!agate!rsoft!mindlink!a347
  3. From: John_Miller@mindlink.bc.ca (John Miller)
  4. Subject: re: Tabbing Speed (long)
  5. Organization: MIND LINK! - British Columbia, Canada
  6. Date: Fri, 6 Nov 1992 22:36:05 GMT
  7. Message-ID: <17207@mindlink.bc.ca>
  8. Sender: news@deep.rsoft.bc.ca (Usenet)
  9. Lines: 163
  10.  
  11. In article <a71de956@random.se>, ianf@random.se (Ian Feldman) writes
  12. > Peter Fleck asks
  13. >-----------------
  14. >
  15. >> I'm looking for tricks to speed up tabbing through fields on a
  16. >> card.  With no enhancements, it takes 4 SECONDS to move from one
  17. >> field to another on a Classic II running System 7 (maybe 7.1, not
  18. >> sure) (HyperCard v2.1).  With the external FastTab (v1.01, is that
  19. >> the latest?) installed, the tab speed is halved (2 seconds).  Any
  20. >> suggestions on further increasing tabbing speed? Any other
  21. >> externals available -- including commercial stuff.
  22. >
  23. >> Is tabbing speed affected by the number of fields on a background
  24. >> or card?
  25. >  yes, tabbing speed is definitely affected by the number of fields
  26. >  -- whether card or background doesn't matter much.  The more there
  27. >  are of them, the longer it will take for the HC to close current/
  28. >  open new internal buffers that it has to maintain for each
  29. >  activated field (remember the undo!).  The more the memory is
  30. >  fragmented, the longer it will take for the OS to find and
  31. >  allocate space for such buffers.  FastTab 1.0.1 XCMD by John
  32. >  Miller works around this problem and is thus able to halve the
  33. >  times for tabbing among fields.
  34.  
  35. I don't think internal buffers and undo have too much to
  36. do with HyperCard's tabbing speed problem.  I would guess
  37. that HyperCard would use a single set of buffers for a
  38. global undo for all fields.  Remember also that undo
  39. handles the changes since the last text selection.  At
  40. least this is the standard Mac behaviour:  I believe
  41. HypCard 2.x does this while HypCard 1.x.x based Undo
  42. on any changes since that field was first selected until
  43. you moved out of that field.  HyperCard 2.x does not
  44. have a speed problem when clicking with the current
  45. field.
  46.  
  47. What is causing the problem is that HyperCard redraws
  48. every field whenever the user presses the Tab key.  Some
  49. of the time is spent on calls to the ToolBox to redraw
  50. each field and the rest of the time is spent on all the
  51. things HyperCard must handle in order to get the field
  52. ready for drawing:  saving/restoring the clip region,
  53. establishing the clip region for the field, moving the
  54. (I believe one shared) TextEdit record and assigning
  55. the text to it.
  56.  
  57. Unfortunately, except for a brief paragraph on the
  58. Example Card, the FastTab documentation stack does not
  59. discuss what issues affect the obtainable speedup.
  60. FastTab works by tricking HyperCard into not redrawing
  61. unnecessary fields.  Fields are treated as an atomic
  62. unit:  if a field has to be redrawn, the entire field
  63. is redrawn.  Also, FastTab makes no attempt to speed
  64. up the actual field drawing:  if a field has to be redrawn
  65. then the drawing speed is the same as for untricked
  66. HyperCard.  The fields that will be redrawn are
  67. 1) The field that had text selected
  68. 2) The field with the newly selected text
  69. 3) Any fields that overlap the old and new fields
  70. 4) Any fields that overlap the overlapping fields.  This
  71. rule is applied recursively, although it is possible
  72. for an unusual field arrangement to fool FastTab.
  73.  
  74. This means that FastTab provides the greatest speedup
  75. for cards containing lots of small non-overlapping fields.
  76. The speedup for cards that contain a small number of
  77. large multi-line fields will be a much less: the number
  78. of fields drawn represents a higher percentage of
  79. the total number and each of these fields take
  80. longer to display than small fields.
  81.  
  82. For a stack that takes 4 seconds to tab on a Classic II,
  83. all the timing tests I have done and the feedback I have
  84. received suggests that the speedup should be at least
  85. 5 times.  Possible reasons that the tabbing time was only
  86. halved in this case are:
  87. 1) The stack contains many large fields, in which case
  88. the previous paragraph explains.
  89. 2) One thing that has trapped several users is the use
  90. of a "backdrop" field behind other fields.  A backdrop
  91. can give an nice shadow grouping to the card layout,
  92. but it means that the overlap fields come into play:
  93. whenever one of the fields in that section of the card
  94. have to redrawn, they all have to be redrawn.  If a
  95. single backdrop field encompasses every other field on
  96. the card, then every field is redrawn and FastTab
  97. is even slower than standard HyperCard tabbing.
  98. 3) Perhaps the field are arranged in some other
  99. highly overlapping arrangement.
  100.  
  101. [In correspondence with the original author of the stack,
  102. he indicated that some of the fields were locked
  103. "label" fields, such as Apple used in the Address stack.
  104. This increases the number of fields, so it should improve
  105. the speedup generated by FastTab, but I would guess that
  106. even better speed would be seen by Mr. Fleck's
  107. decision to convert these labels to paint text.]
  108.  
  109. [...]
  110.  
  111. >  what to do.  Despair not: it _IS_ actually possible to TAB to,
  112. >  enter and modify contents of any particular field at nearly-
  113. >  instantaneous speeds even on the slowest of Macs.
  114.  
  115. No, it's not, but the technique you discuss of using a single
  116. field while scripting tricks create the illusion of separate
  117. fields is an alternate solution to the speed problem.  With my
  118. limited attempts at this approach, I have found it difficult
  119. to maintain the illusion adequately through all possible
  120. user actions -- typing, mousing, cutting/pasting, particularly
  121. if some "fields" in the grid represent calculated values -- but I
  122. suspect that with enough scripting, a suitable illusion could
  123. be created.
  124.  
  125. One thing I find hinders this approach was the change
  126. in openField behaviour between HyperCard 1.2.5 and HypCard 2.x.
  127. HyperCard 1.2.5 would send an openField every time the
  128. mouse is clicked in a field, while HyperCard 2.0 changed this
  129. so that an openField is not sent if the user clicks/drags
  130. in another part of the currently selected field.  I prefer
  131. the old approach: it also makes it easier to do non-standard
  132. things like using single-clicking to select a word.
  133.  
  134. > Believe me, it can be done...  I've done it and can report that
  135. > thus-simulated "tabbing" speeds were 1/4th to 1/2 of those
  136. > achievable with the help of the FastTab XCMD employed on the SAME
  137. > COMPOUND MULTI-LINE field.
  138.  
  139. This is something that the FastTab documentation stack
  140. unfortunately does not discuss.  If you are selecting text
  141. with the currently "active" field, FastTab cannot speed
  142. anything up.  The good news is that the standard HyperCard
  143. "select" command does not have a speed problem when selecting
  144. text in the current field.  The speed problem only comes when
  145. selecting text in a different field (either by tabbing, mousing,
  146. or using the "select" command).
  147.  
  148. So in your design, FastTab can provide no speedup.  It will
  149. be slower because
  150. 1) there is the overhead of loading and invoking the XCMD
  151. 2) the XCMD has its own execution overhead
  152. 3) in the HyperTalk script, the "select" command is translated
  153. to machine code once, when the script is compiled.  If you
  154. use FastTab, HyperCard has to translate the select command
  155. every time it is invoked.  This adds some overhead.  [This
  156. is one reason that *some* HyperTalk scripts run slower
  157. when compiled with CompileIt.]
  158.  
  159.  
  160. > That's right, interpreted HyperTalk
  161. > alone is often faster than an external, compiled command resource.
  162.  
  163. Well, I have now reached the quibble stage, but the accurate
  164. comparision is between this compiled command resource and
  165. the unaided use of a built-in HyperCard primitive, a primitive
  166. that is already plenty fast enough when used as you described.
  167. While FastTab is able to speed things up -- under
  168. certains conditions -- it does not fit into the traditional
  169. speed-based discussion of XCMD versus HyperTalk.
  170.  
  171. John Miller
  172. Symplex Systems
  173.  
  174.