• Adam Jackson's avatar
    miarc: "Cache" arc span data for dashed arcs · 0d7f05ed
    Adam Jackson authored
    This avoids recomputing the span data for every dash. x11perf thinks
    this is a pretty modest speedup:
    
        832919.4       840471.1 ( 1.009)   100-pixel dashed ellipse
        672353.1       680652.2 ( 1.012)   100-pixel double-dashed ellipse
         13748.9        24287.9 ( 1.767)   100-pixel wide dashed ellipse
          9236.3        21298.2 ( 2.306)   100-pixel wide double-dashed ellipse
    
    But part of the reason it's so modest there is that the arcs are
    relatively small (100 pixel diameter at line width 10, so ~6000 pixels)
    and the dashes relatively large (30 on 20 off so ~6 dashes per
    quadrant).
    
    With larger arcs and finer dashes this is much more impressive. A fairly
    trivial testcase of a single 15000x13000 arc with the default {2, 2}
    dash pattern drops from ~3500 milliseconds to 10 milliseconds.
    Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
    Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
    0d7f05ed