1 more speed question

Richard Gaskin ambassador at fourthworld.com
Wed May 18 14:28:16 EDT 2005


> Looking forward to the results of the speed test,

When it comes to the difference between case blocks and if blocks, I'll 
make a prediction:

The difference will be negligible relative to the benefits of using the 
most readable choice for the problem at hand.

While my experience with older xTalks had me something of a benchmark 
fanatic, the more I work with the Rev engine the less benchmarking I do.

Aside from a handful of basics, I find the differences between most 
constructs to be very, very small.  In most cases the benefits of saving 
hours in maintenance over the life of a product by using the choice that 
makes for more readable code is a better savings than a fraction of a 
millisecond for one which may be technically more efficient.

What basics?  Off the top of my head:

- Use "repeat for each" wherever possible over "repeat with"

- Use fields only when text needs to be displayed; if data is
   merely stored by the user doesn't need to see if you'll get
   far better performance using custom properties

- If a field must be accessed but not necessarily seen by the
   user (such as translating to/from htmlText/rtfText) using
   a field on an unopened card will boost cut the time for that
   operation roughly in half

- When in serious doubt, it only takes a minute to benchmark
   alternatives.  When the difference is a fraction of a
   millisecond, unless the operation must be called many times
   within a loop your project management will likely benefit
   from going with the option that's easier to read

--
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the use-livecode mailing list