Scripters Scrapbook
Alex Rice
alrice at arcplanning.com
Thu Aug 28 14:50:00 EDT 2003
On Thursday, August 28, 2003, at 01:05 PM, FlexibleLearning at aol.com
wrote:
> I collected the following tips and tricks over the years... Feel free
> to disagree, add or ignore
OK! this is definitely going in my revolution tips and tricks folder.
> - Balance length of handler with compiling time overhead and the
> shareability of smaller, more quickly compiled, utility handlers and
> functions.
Does 1 long handler take less time to compile than 10 small handlers?
(accomplishing roughly the same task)
> - Keep a list of all global variables, and put empty into them when
> you close the project for clean housekeeping.
That is interesting. globals persist in the IDE (and I assume in a
standalone while running) even after the stack is closed- even if
"purged" from memory. I guess that makes sense. Globals are sure...
global.
> - Use a consistent naming convention: g_GlobalName, t_LocalName,
> a_ArrayName. Some folks also name built-in handlers and function with
> a lowercase initial letter and their own with an uppercase leet eg 'on
> mouseUp' but 'on ShowItems' so things can be more easily identified.
Richard Gaskin's style guide recommends no underscores which I tend to
agree with. Following this guide has really helped me clean up my
scripting:
http://www.fourthworld.com/embassy/articles/scriptstyle.html
> - Setting lockMenus to true in SC speeds up menu operations by a
> factor of 20.
Speaking of which, why do the Rev docs say "lockMenus" has no effect on
Win and Unix?
> - Functions with brackets take longer than functions without brackets
> when you have the choice eg "topWindow()" is slower than "the
> topWindow" in MC.
You mean brackets or parenthesis?
Is it correct to state that in Rev only builtin functions can be
accessed with either form: topWindow() vs. the topWindow
How do they do that, make a handler and a function with the same name?
> - Add a zero to variable names in calculations to force them into
> binary format. Subsequent calculations are very much faster since they
> don't have to be interpreted as text.
Does this work for Rev too? I don't remember seeing that notation
before.
> - The fewer the characters, the faster they compile; "num of flds" is
> quicker than "the number of background fields".
Considering this issue, plus the fact that the Rev distribution builder
does not remove comments when building a standalone, a very useful
plugin for the distribution builder would be one that makes a copy of
the stack, strips comments out of scripts, and replaces object names
with compact hex codes, and object references with abbreviations (like
bg instead of background) to produce smaller stack sizes and faster
runtime compilation.
> - Try using modal windows rather than popup fields.
Can you give an example when it would advantageous?
Thanks,
Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com
More information about the use-livecode
mailing list