Commit a67cd8e5 authored by Jeremy Harris's avatar Jeremy Harris

Implement tree-height evaluation

Gives 20% better perf during initial file-read phase, before plotting starts
parent 02636bd2
......@@ -283,10 +283,8 @@ avl_rebalance(plotter * pl, command * c)
h = 1 + avl_max_height(c->avl_left, c->avl_right);
x_max = avl_max_x_coord(pl, c);
#ifdef notdef /* lacking equality-op for coord, re-eval full height of tree */
if (h == c->avl_height)
return;
#endif
c->avl_height = h;
c->avl_x_max = x_max;
TRACE errprintf(" %s %s\th %u sxm %s",
......@@ -367,9 +365,8 @@ avl_insert(plotter * pl, command * c)
c->avl_parent = node;
x_max = avl_max_x_coord(pl, node);
#ifdef notdef /* lacking equality-op for coord, re-eval full height of tree */
if (node->avl_height == 1) || x_max != node->avl_x_max)
#endif
if (node->avl_height == 1 || memcmp(&x_max, &node->avl_x_max, sizeof(coord)) != 0)
{
node->avl_height = 2;
node->avl_x_max = x_max;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment