Sorry for the silence

Banshees on the WindSorry for the silence of the past few days; I’ve been working on a possible fix to the theme rendering code, after the test suite told me that the part which calculates the value of expressions was a bit slow.  Currently it tokenises during theme load but parses every evaluation.  I thought that if I parsed it into some stack-based form on theme load, it might take slightly longer to load a theme, but everything would draw faster by just evaluating the stack-based version.  (I also took the opportunity to do all floating-point arithmetic using scaled integers, because I’m stuck in 1988.)

In practice, though, the results have been disappointing: it only seems to have saved a few microseconds here and there.  So it’s probably not worth the disruption of merging it, though it does also make the code 584 lines shorter, mainly through its use of a GScanner instead of tokenising in house.  I think it also makes the code a bit easier to read.  I’ve put the patch up in case anyone fancies suggesting how it can be sped up a bit further.

(One optimisation that the existing version does that the patch doesn’t do is evaluate constant expressions at theme load time– so if you have Fred+1 where Fred is a constant equal to 2, it will store just 3 and not bother doing the evaluation.  I’m not sure whether that would give much extra speed to the new code.)

Still, experiments are worth doing even if they fail!

Photo © Dead Air, cc-by-nc-sa.

Published by

Thomas Thurman

Mostly themes, triaging, and patch review.

4 thoughts on “Sorry for the silence”

  1. @Hobosic:

    All the photos posted on this blog are licenced under Creative Commons and none of them are original to us. The attribution at the foot of each post says where they come from. Most of them are taken from Flickr. If you click the photo it will take you to the original page.

Comments are closed.

Leave a Reply

Your email address will not be published. Required fields are marked *