Main Page
Articles
Demos
Downloads
Tips-N-Things
Land-O-Links
About Me
RSS feed

Contact

blurredistinction

just a bunch of it

Eventually I suppose I'll organize this - maybe stick it all in a database like I've always wanted and make it searchable, let people add stuff, etc. For now though, this is just as the title says it is. I'll put tips, optimizations, hacks, etc. here as I come across them.

Last update: 04-29-2005

speed optimzations

1. To see if a list is empty use the count property of the list instead of comparing the list to an empty list:
ie: if someList.count = 0 and not this: if someList = []
Checking the count is over two times faster than comparing to an empty list.

2. When concatenating strings use put after instead of &
ie: put someString after someOtherString and not this: someOtherString = someOtherString & someString
This optimization becomes more apparent as the length of the string being appended increases.

3. Always use references!
ie: lCount = myList.count
repeat with counter = 1 to lCount --here the list count is evaluated just once
and not:
 repeat with counter = 1 to myList.count --here the list count has to be evaluated at every loop iteration.

4. String equality: Using starts is over two times faster than testing equality.
ie: string1 starts string2
and not:
string1 = string2

network tips

1. If calling an ASP CGI script - if you get an error code of 4165 back it typically means that an error occured in the ASP script.

2. A 2018 error means that you used postNetText without sending variables. In this case use getNetText instead.

Imaging Lingo

1. A super fast method of doing a pixel based image equality test surfaced on Direct-L the other day. Thanks to Jilt van Moorst for it.
imagesEqual = (member(a).image = member(b).image)

2. In authoring, remember to close the Score, PI, and Cast window when doing testing. If left open, the thumbnail update of the member image kills performance.

misc tips

1. You can populate a list by setting some index in the list to a number.
     ie: myList = []
     myList[100] = 5 --will place 5 at index 100, and put 0's into indexes 1-99

2. You can use lists to do case sensitive string comparisons.
     ie: put "Steve" = "steve"
     --1
     put list("Steve") = list("steve")
     --0