Posts by this author

May 24, 2005
Post comments count0
Post likes count0

Understanding ternary raster operations

It's perfectly logical, which doesn't mean that it's easy to understand. A ternary raster operation describes how three boolean values should combine to form an output boolean. I was going to write up a description but found that the existing documentation pretty much covers it, so I refer you to that. In particular, look at the table that expla...

Code
May 24, 2005
Post comments count0
Post likes count0

Boil first, then mash

Last year, British schoolchildren (ages six and seven) went to a farm and were baffled by the long, pointy, orange things. (Those who specialize in plant biology have a special term for these strange objects: carrots.) Their older siblings don't seem to be faring much better. A three-year study revealed that modern Scottish schoolchildren lacke...

Non-Computer
May 23, 2005
Post comments count0
Post likes count0

Why are DLLs unloaded in the "wrong" order?

When a program starts or when a DLL is loaded, the loader builds a dependency tree of all the DLLs referenced by that program/DLL, that DLL's dependents, and so on. It then determines the correct order in which to initialize those DLLs so that no DLL is initialized until after all the DLLs upon which it is dependent have been initialized. (Of cour...

Other
May 20, 2005
Post comments count0
Post likes count0

I'd like to register my stolen car, please

On NPR's All Things Considered Robert Siegel reported on the curious status of legally stolen cars in Gaza. Gaza license plates can be red for official, green for taxis, and white for private vehicles. The lower the number on the red plates, the higher the position of the official. The number 30 designates a truck. All this is pretty convention...

Non-Computer
May 20, 2005
Post comments count0
Post likes count0

When is a window visible yet not visible?

Today, a quick puzzler. Consider the following code fragment: We just showed the window, certainly it is visible, right? Yet the assertion can fire (even in the absence of multi-threading). Why? Answer below - stop reading if you want to try to solve it yourself. Take a look at the function. If the specified windo...

Code
May 18, 2005
Post comments count0
Post likes count0

Loading the dictionary, part 5: Avoiding string copying

Looking at the profile for our program so far, 35% of the CPU time is spent copying strings around. Let's see if we can improve that. The best way to speed up copying strings is not to copy them in the first place. Using a in our structure forces the class to copy the string data, when all we really need to copy is the pointer and size infor...

Code
May 17, 2005
Post comments count0
Post likes count0

You can't escape those AOL CDs

One of my colleagues was unpacking one of those $30,000 quad-processor more-memory-than-you-know-what-to-do-with super-server computers. The kind that require their own electrical substation. And it came with an AOL CD. It's like buying a Lexus and finding a 35-cents-off coupon in the glove compartment. Apparently, one of the questions AOL tech ...

Other
May 16, 2005
Post comments count0
Post likes count0

Loading the dictionary, part 4: Character conversion redux

Getting rid of was a big help, but 480ms is still not quite peppy enough. You need to respond to user actions within a tenth of a second for thing to seem responsive. Profiling the latest endeavor reveals that 40% of our CPU time is spent in . Some debugging reveals that ultimately calls but uses it to convert only one or two characters at ...

Code
May 13, 2005
Post comments count0
Post likes count0

Loading the dictionary, part 3: Breaking the text into lines

Even after moving the character conversion out of the function, profiling reveals that is still taking nearly 50% of our CPU. The fastest code is code that isn't there, so let's get rid of altogether. Oh wait, we still need to break the file into lines. But maybe we can break the file into lines faster than did. This very simple class baby...

Code