2-Dec-2002 00:24 Bela Lubkin wrote: The patch - below.
> I tested on the pages: > http://www.armory.com/cache/userinfo.html > http://www.armory.com/cache/userinfo-t.html > which are two different versions of 450 lines of data with multiple > links per line. I tested rendering speed on the basic data files, then > on versions where I had duplicated the 450 data lines an additional 7 or > 15 times (8 or 16 total copies, 3600 or 7200 total lines). I compared > performance of an old Lynx 2.8.4dev.20 binary vs. today's 2.8.5dev.11. > I also compared output, verifying that they were in fact identical. > The results show that Leonid grossly underestimated the benefits of his > changes: > File 2.8.4dev.20 2.8.5dev.11 > -dump -dump > -dump -nolist -dump -nolist > userinfo450.html 0.10 0.08 0.08 0.06 > userinfo450-t.html 0.10 0.11 0.09 0.10 > userinfo3600.html 4.95 2.50 0.48 0.42 > userinfo3600-t.html 5.30 4.56 0.54 2.50 > userinfo7200.html 28.24 10.54 0.93 0.83 > userinfo7200-t.html 27.93 20.25 1.08 10.29 > (CPU-seconds on 1GHz Pentium III) > Leonid's changes make performance (on this data set) linear in the > number of lines, vs. some sort of quadratic behavior. 30 times as fast, > in the worst case here. Bravo. > Oddly, `lynx -dump -nolist` is now slower than `lynx -dump` in some > cases... Still cannot figure why -nolist is slower, but you help me fix one more quadratic behaviour issue: userinfoNNN-t.html is a huge table with lots of anchors. STbl code calls insert_blanks_in_line() repeatedly, each time anchors traversed from the table starting point. Now incremented internally. It also occasionally cleanup split_line() a bit. Bela, try this patch and send us the updated runtime results:) --- gridtext.old Tue Dec 3 02:17:00 2002 +++ gridtext.c Tue Dec 3 14:09:52 2002 @@ -2491,7 +2491,7 @@ PRIVATE HTLine * insert_blanks_in_line A HTLine *, line, int, line_number, HText *, text, - TextAnchor *, prev_anchor, + TextAnchor **, prev_anchor, int, ninserts, int *, oldpos, /* Measured in cells */ int *, newpos) /* Likewise */ @@ -2527,9 +2527,9 @@ PRIVATE HTLine * insert_blanks_in_line A POOLallocHTLine(mod_line, line->size + added_chars); if (!mod_line) return NULL; - if (!prev_anchor) - prev_anchor = text->first_anchor; - head_processed = (prev_anchor && prev_anchor->line_num < line_number); + if (!*prev_anchor) + *prev_anchor = text->first_anchor; + head_processed = (*prev_anchor && (*prev_anchor)->line_num < line_number); memcpy(mod_line, line, LINE_SIZE(0)); t = newdata = mod_line->data; ip = 0; @@ -2560,7 +2560,7 @@ PRIVATE HTLine * insert_blanks_in_line A /* Now s is at the "displayed" char, pre is before the style change */ if (ip) /* Fix anchor positions */ - move_anchors_in_region(line, line_number, &prev_anchor, + move_anchors_in_region(line, line_number, prev_anchor /*incr++*/, &head_processed, copied - line->data, pre - line->data, shift); @@ -2588,8 +2588,8 @@ PRIVATE HTLine * insert_blanks_in_line A while (pre < s) /* Copy remaining style-codes */ *t++ = *pre++; /* Check whether the last anchor continues on the next line */ - if (head_processed && prev_anchor && prev_anchor->line_num == line_number) - prev_anchor->extent += shift; + if (head_processed && *prev_anchor && (*prev_anchor)->line_num == line_number) + (*prev_anchor)->extent += shift; *t = '\0'; mod_line->size = t - newdata; return mod_line; @@ -3234,7 +3234,7 @@ PRIVATE void split_line ARGS2( i++; } jline = insert_blanks_in_line(previous, CurLine, text, - last_anchor_of_previous_line, + last_anchor_of_previous_line /*incr++*/, ht_num_runs - 1, oldpos, newpos); free((char*)oldpos); if (jline == NULL) @@ -3245,21 +3245,11 @@ PRIVATE void split_line ARGS2( previous = jline; } { /* (ht_num_runs==1) */ - /* keep maintaining 'last_anchor_of_previous_line' */ - TextAnchor* a2 = last_anchor_of_previous_line; if (justify_start_position) { char* p2 = previous->data; for( ; p2 < previous->data + justify_start_position; ++p2) *p2 = (*p2 == HT_NON_BREAK_SPACE ? ' ' : *p2); } - - if (!a2) - a2 = text->first_anchor; - else - a2 = a2->next; /* 1st anchor on line we justify */ - - for (; a2 && a2->line_num <= text->Lines-1; - last_anchor_of_previous_line = a2, a2 = a2->next); } } else { if (REALLY_CAN_JUSTIFY(text) ) { @@ -4506,7 +4496,7 @@ PRIVATE int HText_insertBlanksInStblLine continue; } mod_line = insert_blanks_in_line(line, lineno, me, - me->last_anchor_before_stbl, + &me->last_anchor_before_stbl /*incr++*/, ninserts, oldpos, newpos); if (mod_line) { if (line == me->last_line) { ; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to [EMAIL PROTECTED]
