Cheetah template tip: you want _namemapper for Windows

Feb 15, 2005 16:17 · 221 words · 2 minute read

I do most of my work on my Mac, hopping over to the PC for additional integration and build testing. I already have someone who is running Windows builds regularly, though, so any Windows-specific problems will get shaken out. I was testing out my latest build on Windows and found that it was very slow. I tossed a timer onto the page and found that it was taking 21 seconds to render. I added a database index I had been meaning to add, but I didn’t think that would do it because my database had a trivial amount of data.

That was when I remembered that the script for Cheetah assumes that you don’t have a C compiler if you’re running Windows. I’m working with enough modules that it was well worth getting a functional MinGW setup going. I changed Cheetah’s to enable the _namemapper C module.

The rendering time for that page dropped to 0.06 seconds, 350 times faster. It sure seems like you need _namemapper for any but the most trivial templates. Given that, I would probably make count on a C compiler first, and let the user comment out that line if they don’t have one.

If you’re considering using Cheetah under Windows, don’t call it “too slow” until you’ve tried it with C _namemapper.