Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

XSL caching

XSL caching

superpig
Continuous Refinement · · 1 min read
374 2
I went in and turned on XSL caching for the site today. From the looks of it, someone had originally implemented it, but not gotten it working to their satisfaction so commented it out again. I've rewritten it, turned it on, and nothing appears to have broken. Things even seem a little bit faster.

Many parts of the site - for example, viewing a thread - are rendered by taking a XML-formatted view of the thread and passing it through an XSLT stylesheet that converts the XML into XHTML. XSLT is actually a full functional programming language, and when you load it in to do transforms, the first thing MSXML does is to convert it into a form more efficient for doing those transforms ("compiling" it). The output of that compilation is always the same for a given input stylesheet. So, what we were doing before was re-compiling all stylesheets used on every request; what I've done is to cache the resulting XSLTransform objects so that they can just be immediately applied to input XML data without needing to be recompiled.

As I said, I think things seem a little faster, but that might just be in my head. I'm also curious as to why exactly it wasn't implemented in the first place - usually when I see something like this it rings alarm bells for me because rather than assuming that I'm "so much smarter" than the previous guy, I assume that s/he knew about it too but didn't implement it because of something that I've missed. Still, it looks like it's working so far...

Discussion

Loading comments...