Saturday, April 07

Geek

Accelerando

I'm in the middle of a huge update to Minx - I've uploaded the new software, and I'm testing the new templates on my blog.

One of the things I'm working on is making the template engine even more dynamic.  I've mentioned that there are a huge number of fields available in Minx. One of the problems with that is that the data for those fields is generated whether you need it or not, so simply selecting a post, even if you only displayed a single field from it, took on the order of 2ms.

For my first pass I changed the way dates and times are handled.  This was relatively easy, because all dates and times are datetime objects, and they all had a base tag of the form [something.date].

I took that and ran with it, finding all the date and time fields, removing all the static formatting, and creating alternate references for time, datetime, shortdate, day, month, and year. Eventually I may be able to do away with the references as well, but that requires some more significant changes to the template engine. Right now, a data tag is either in the dictionary or it isn't; tags are statically selected, but dynamically formatted.

The end result?  Existing templates work without change, there are 44 (I think) new date-related fields on the post record alone, the time for processing my main page has been cut by around 12%, and the code is actually smaller.  Plus, all date and time fields can now be custom formatted using the format option; before, the preformatted versions were strings and date formatting options didn't work.

The only downside is that I have to document hundreds of new tags, though the upside there is that they are all perfectly orthogonal, so I can pretty much just cut and paste.

Next cut will be text formatting; I expect similar or greater gains from that.

Posted by: Pixy Misa at 02:43 AM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 321 words, total size 2 kb.

Comments are disabled. Post is locked.
46kb generated in CPU 0.0532, elapsed 0.1321 seconds.
54 queries taking 0.1224 seconds, 356 records returned.
Powered by Minx 1.1.6c-pink.