[thelist] Friday Freebie

Scott Dexter sgd at ti3.com
Fri Dec 29 16:50:08 CST 2000


Wishing everyone a happy (gregorian calendar) New Year!

<tip type="more simple optimizations">
* use local storage of values whenever you can. Repeated access to Session
variables, cookies, structures, etc. are wasteful. Example:

pig = Session(pig)
for i=0 to 100
  pigcounter = pig + i
next

* if your (scripting) language permits, declare *and* type your variables
explicitly. This saves the parser and compiler guess work, which equals
faster execution. In some environments, like VBScript, there is only one
type --variant-- but you can still at least declare the variables

* when writing a function/subroutine, make all your inputs parameters
instead of using global variables inside the routine/function. Not only is
this a performance thing (using local storage), but also a modular and
maintainability thing. You will save yourself many headaches. Trust me

* Be smart with passing variables by reference and passing by value. There
are times when passing by value is faster (scalar values, like integers ans
strings), and when passing by reference is faster (objects, arrays)
</tip>

sgd
--
work: http://www.ti3.com/
non: http://thinksafely.org/




More information about the thelist mailing list