Path: utzoo!attcan!uunet!husc6!think!ames!pasteur!ucbvax!decwrl!labrea!csli!nash From: nash@csli.STANFORD.EDU (Ron Nash) Newsgroups: comp.sys.mac.hypercard Subject: HyperTalk efficiency Message-ID: <4348@csli.STANFORD.EDU> Date: 20 Jun 88 02:11:09 GMT Reply-To: nash@csli.UUCP (Ron Nash) Organization: Center for the Study of Language and Information, Stanford U. Lines: 39 As anyone who's tried to write a decent-sized hypercard application knows so well: by the time you build in a reasonable amount of error checking, the whole thing runs so damn slow -- especially a multi-stack program on a Mac+ -- that you wonder whether it's all worthwhile. Version 1.2 adds some functions that make life a good deal easier. (Still, the popup fields in the new release notes stack are disappointingly slow on a Mac+). The point of this posting is to solicit strategies for increasing the efficiency of hypertalk code: algorithms, data structures, stack structures, etc. As someone who occasionally takes on fairly large projects (my last had about 3500 lines of code), I'm looking to get some pointers. But let me start things off with one technique I've found to be a real timesaver. Scenario: a multi-stack program. A handler in stack A accepts some input from the user and goes off to stack B to perform various complicated functions, returning to stack A when done. It turns out that putting the code for these various complicated functions in a handler in stack A is a real time sink. This is painfully obvious when you run the code on a MacII and see hypercard continually flip back and forth between stacks (as evidenced by the changing pathnames in the title bar). The solution is simple, but a major win: put all the code for the complicated functions in stack B, and have the handler in stack A send doComplicatedFunctions to stack B. Stack flipping is reduced to a minimum, and the same functions execute in about 1/10 the time (your mileage may vary). -Ron Nash Center for the Study of Language and Information Stanford University nash@csli.stanford.edu