So, why is Human slow?

A Man And A WomanI mentioned a while back that Human is the slowest of all common themes, taking 6ms to draw the average frame.  It occurred to me to wonder why this might be, of course, so I took the opportunity to instrument it.  Here are the results.  The height of the diagram spans six milliseconds.  You will note firstly that the theme carries out a large number of very simple operations like lines and rectangles, which are very fast, and next that there are four long pauses which I have numbered in red:

  1. Drawing a gradient.  This is the first gradient in title_background, covering the entire width of the titlebar and half its height. There are three other gradient operations, and none of them take that long; this could be some caching mechanism in GDK but is more likely to be because at least one of them is only a single pixel high.  The other two are a bit of a mystery; the output says they should be part of piece 11, bottom_edge, but that isn’t used in Human.
  2. Drawing a tint.  Again, it’s the first one in corners_hilight_shaded, so maybe some caching effect, but this is also the only tint which is 1×2 pixels high instead of just 1×1; there is one tint which is 2×1, and this is visible taking longer slightly below the number 2.
  3. Drawing the title text.  This happens four times, and two are very fast and one is very slow.  I can’t account for this.
  4. Drawing the title text again; see above.

I think this shows that gradients and tints need to be faster.

(Update follows >>>)

Photo © just.Luc, cc-by-nc-sa.

4 Comments

  1. Nick
    Posted February 6, 2009 at 7:56 am | Permalink

    How’d you create that diagram? That sort of thing would have saved me a lot of squinting through debug output over the years.

  2. Posted February 6, 2009 at 5:12 pm | Permalink

    It was based on Federico’s performance-scripts, but the output was processed by a perl script I wrote to produce the SVG. I might make it public, then.

  3. Posted March 7, 2009 at 10:33 pm | Permalink

    @Nick:

    Posted the script here.

  4. Nick
    Posted March 7, 2009 at 11:11 pm | Permalink

    Thanks!

3 Trackbacks

  1. […] Thurman: So why is Human so slow? It turns out that Human, the default theme on Ubuntu, takes longer then any other common theme to […]

  2. […] …for the adult in you “Many window managers are like Marshmallow Froot Loops; Metacity is like Cheerios.” Skip to content « So, why is Human slow? […]

  3. By Performance scripts with SVG « ᛏᚦ on March 7, 2009 at 10:24 pm

    […] was asked where I got the tools to make graphs like this one (for this post).  It’s a custom variation on Federico’s Performance Scripts which outputs SVG […]