Commits

Yuya Nishihara committed 376c573

graph: uncache active value to reduce complexity of sorting lines

isactive() is not costly.

Comments (0)

Files changed (1)

tortoisehg/hgqt/repomodel.py

             ymid = (y1 + y4)/2
             y3 = y1 + 3 * (y4 - y1)/4
 
-            lines = sorted(((isactive(e), p, e) for p, e in lines),
-                           key=lambda ape: (ape[0], ape[2].importance))
+            lines = sorted(lines,
+                           key=lambda pe: (isactive(pe[1]), pe[1].importance))
 
-            for active, (start, end), e in lines:
+            for (start, end), e in lines:
+                active = isactive(e)
                 lpen = QPen(QColor(active and get_color(e.color) or "gray"))
                 lpen.setStyle(get_style(e.linktype, active))
                 lpen.setWidth(get_width(e.linktype, active))