2002.10.29 ~00 q3asm "static" and balanced binary tree done http://www.icculus.org/~phaethon/q3a/q3asm-turbo/q3asm-turbo.html http://www.linux.ucla.edu/~phaethon/q3a/q3asm-turbo/q3asm-turbo.html I did it. Two birds with... uh... two stones. Two separate forked updates. The first is just a straight port of the old q3asm to the 1.32 SDK, so that patch(1) stays quiet. The second has some major mojo. Firstly, I finally carried out my threat of moving the data structures from hashtables to (balanced) binary trees. The speed improvement over hashtables isn't very dramatic, but still noteworthy. Empirical testing suggests a time decrease of 10% to 30% compared to hashtables. I'm too lazy to set up millisecond-resolution timing, but it feels faster to me. I actually cracked open my CS textbook and read through the trees chapter for the nth time. I finally half-grok what's going on with the rotations, but I'd be ****ed if I have to implement a R-B tree from scratch on a blank screen without any references. An added benefit of putting in trees is extra flexibility in additional data... data... err... yeah, additional data. For example, a mapping of private symbol names to public symbol names. Such as that implied by the "static" keyword in C. As I had priorly brainstormed, all symbols in a file are mangled based on filename (actually, file index number, but close enough) to mimic private namespaces. The "export" assembler directive, which takes as the sole parameter the name of the local symbol to be made global, creates a mapping such that the specified global name resolves to the file's particular private symbol (name). The "import" directive acts similarly, creating a mapping such that the local private symbol name resolves to the global name, then recursively re-resolves to the "actual" private symbol in the other file('s namespace). These mappings are sorted and searched in a balanced binary tree. Good thing, too, since there are upwards of 20K such entries. Basically, it was a matter of mimicking private namespaces and shifting names between those (fake) namespaces.