performance

A 1-post collection

When you know you're coding in the wrong language

SphereServer is/was a fantastically fun piece of emulation software for the old and beloved Ultima Online MMORPG, from back in the day before emulation had even a mention in their End User License Agreement. I knew it originally as TUS (The Ultimate Server).

TUS was actually some of my first, ever programming, and SphereServer was my stomping ground for a long time, where in the early days I was extremely active. I've been out of that loop for some time now, but Sphere doesn't exactly have a tight release schedule and in all likelihood these experiences still apply—or they may not, I would be interested in hearing. For now I will speak from back a few years.

SphereServer's scripting language is interpreted, which in this case meant slow. Now I hear the argument, "Well so what? It was fast enough." And my response is, actually, no, it was too slow (and may still be).

Now if all you were interested in was tweaking loot tables, adjusting skill gain, invisibility cloaks and vorpal swords, then you didn't have much of a problem. If on the other hand you were creating complex housing, support, communication, battle and magic systems like I was, then more than likely you were using the wrong language in the wrong software.

In a contemporary programming language you're afforded the benefit of coding for readability, because many optimizations are micro-optimizations and simply don't matter. Not so with Sphere's interpreted language. Wanted to use one variable for exactly one purpose (new variables for new purposes)? Slow. Test a few different things in one conditional statement to avoid excessive nesting? Slow, Sphere doesn't use short-circuit evaluation. Nest like crazy for performance over readability? You still might not have got it! Parsing the additional lines was slow again. How about making good use of functions anywhere you could make a useful abstraction? Slow!

Unfortunately the text parsing of the script itself was a problem. Every line or character added for readability or maintainability detracted from performance, and not in a theoretical way, but a large and measurable way. There was a constant battle waged as balance was sought between readability (which will yield performance over time) and immediate performance.

The loser was quite evident though, that would be us:

[FUNCTION contents]
IF <RESCOUNT>
    VAR.COUNT <RESCOUNT>
    contents_r <ARGS>
ENDIF

[FUNCTION contents_r]
IF <VAR.COUNT> >= 200
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 2>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 3>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 4>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 5>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 6>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 7>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 8>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 9>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 10>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 11>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 12>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 13>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 14>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 15>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 16>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 17>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 18>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 19>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 20>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 21>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 22>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 23>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 24>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 25>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 26>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 27>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 28>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 29>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 30>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 31>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 32>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 33>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 34>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 35>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 36>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 37>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 38>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 39>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 40>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 41>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 42>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 43>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 44>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 45>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 46>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 47>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 48>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 49>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 50>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 51>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 52>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 53>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 54>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 55>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 56>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 57>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 58>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 59>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 60>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 61>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 62>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 63>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 64>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 65>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 66>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 67>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 68>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 69>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 70>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 71>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 72>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 73>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 74>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 75>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 76>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 77>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 78>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 79>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 80>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 81>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 82>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 83>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 84>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 85>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 86>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 87>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 88>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 89>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 90>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 91>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 92>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 93>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 94>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 95>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 96>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 97>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 98>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 99>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 100>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 101>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 102>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 103>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 104>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 105>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 106>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 107>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 108>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 109>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 110>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 111>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 112>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 113>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 114>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 115>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 116>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 117>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 118>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 119>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 120>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 121>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 122>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 123>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 124>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 125>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 126>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 127>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 128>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 129>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 130>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 131>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 132>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 133>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 134>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 135>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 136>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 137>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 138>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 139>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 140>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 141>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 142>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 143>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 144>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 145>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 146>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 147>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 148>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 149>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 150>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 151>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 152>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 153>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 154>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 155>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 156>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 157>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 158>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 159>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 160>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 161>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 162>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 163>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 164>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 165>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 166>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 167>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 168>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 169>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 170>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 171>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 172>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 173>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 174>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 175>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 176>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 177>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 178>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 179>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 180>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 181>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 182>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 183>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 184>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 185>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 186>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 187>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 188>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 189>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 190>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 191>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 192>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 193>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 194>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 195>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 196>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 197>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 198>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 199>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 200>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 200
ELIF <VAR.COUNT> >= 100
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 2>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 3>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 4>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 5>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 6>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 7>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 8>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 9>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 10>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 11>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 12>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 13>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 14>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 15>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 16>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 17>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 18>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 19>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 20>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 21>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 22>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 23>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 24>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 25>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 26>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 27>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 28>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 29>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 30>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 31>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 32>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 33>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 34>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 35>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 36>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 37>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 38>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 39>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 40>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 41>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 42>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 43>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 44>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 45>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 46>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 47>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 48>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 49>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 50>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 51>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 52>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 53>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 54>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 55>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 56>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 57>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 58>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 59>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 60>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 61>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 62>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 63>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 64>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 65>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 66>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 67>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 68>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 69>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 70>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 71>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 72>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 73>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 74>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 75>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 76>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 77>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 78>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 79>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 80>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 81>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 82>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 83>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 84>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 85>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 86>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 87>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 88>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 89>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 90>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 91>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 92>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 93>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 94>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 95>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 96>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 97>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 98>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 99>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 100>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 100
ELIF <VAR.COUNT> >= 50
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 2>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 3>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 4>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 5>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 6>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 7>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 8>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 9>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 10>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 11>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 12>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 13>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 14>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 15>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 16>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 17>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 18>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 19>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 20>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 21>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 22>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 23>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 24>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 25>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 26>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 27>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 28>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 29>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 30>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 31>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 32>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 33>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 34>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 35>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 36>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 37>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 38>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 39>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 40>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 41>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 42>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 43>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 44>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 45>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 46>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 47>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 48>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 49>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 50>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 50
ELIF <VAR.COUNT> >= 25
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 2>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 3>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 4>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 5>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 6>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 7>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 8>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 9>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 10>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 11>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 12>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 13>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 14>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 15>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 16>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 17>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 18>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 19>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 20>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 21>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 22>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 23>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 24>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 25>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 25
ELIF <VAR.COUNT> >= 12
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 2>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 3>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 4>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 5>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 6>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 7>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 8>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 9>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 10>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 11>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 12>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 12
ELIF <VAR.COUNT> >= 6
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 2>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 3>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 4>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 5>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 6>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 6
ELIF <VAR.COUNT> >= 3
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 2>.<ARGS>
    TRY FINDCONT.<EVAL <VAR.COUNT> - 3>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 3
ELIF <VAR.COUNT> >= 1
    TRY FINDCONT.<EVAL <VAR.COUNT> - 1>.<ARGS>
    VAR.COUNT <VAR.COUNT> +- 1
ELSE
    VAR.COUNT
    RETURN 1
ENDIF

contents_r <ARGS>
RETURN 0

Why did we stick with it for so long? Well aside from an acceptable level of relative completeness, its particular infrastructure meant code could be adjusted in almost real-time, a feature I reveled in as superior to competitive offerings from the likes of RunUO (which actually came much later). Of course this was a blessing and an absolute curse, I think we countered the not so uncommon effects of corrupted state with the careful application of not giving a !@#$.

One of my close fellow enthusiasts even went so far as to create his own language, PySphere, to abstract away the crazy. I liken this to JavaScript compression. While the resultant Sphere script was highly obfuscated, it was very fast. At first I thought he was nuts, but looking back he was the saner of us looneys.

I eventually caught on, and so can you. If you're doing anything of substance in SphereServer, a budding programmer yourself, I ask:

Is Sphere fast enough for your code to be as readable as it should be?

If you aren't sure, give Code Complete a read, then try scripting and ask yourself again. You may not know what readable code looks like. ;)

Discussion