lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev a BIG optimization for large pages (patch5)


From: Leonid Pauzner
Subject: lynx-dev a BIG optimization for large pages (patch5)
Date: Sat, 19 Oct 2002 20:18:02 +0400 (MSD)

Playing with my large file and a profiler
I have resolved one more hot point, now in split_line():


* a *big* optimization for large html files - with thousands of links -
  remove quadratic complexity from split_line() usage, in GridText.c
  Because of some work with anchors on the last(=splitted) line,
  the anchors list was traversed from the beginning for each output line.
  Now first_anchor is a double-linked list (since reverse search appears),
  so we can walk from the last_anchor easily.  With my 800Kb test file
  (13000 output lines, 3100 anchors)  this shows 25% speedup: split_line
  weight decreased from 26% down to 1%  - LP


diff -u old/gridtext.c ./gridtext.c
--- old/gridtext.c      Wed Oct 16 02:40:52 2002
+++ ./gridtext.c        Sat Oct 19 19:17:58 2002
@@ -3091,7 +3091,6 @@
      */

     if (s > 0) {                       /* if not completely empty */
-       TextAnchor * prev_a = NULL;
        int moved = 0;

        /* In the algorithm below we move or not move anchors between
@@ -3103,7 +3102,14 @@
         */
        /* Our operations can make a non-empty all-whitespace link
           empty.  So what? */
-       for (a = text->first_anchor; a; prev_a = a, a = a->next) {
+
+       /* go up from the last anchor: */
+       for (a = text->last_anchor; a; a = a->prev) {
+           if (a->line_num < CurLine)
+                       break;
+       }/* and now back: */
+
+       for ( ; a; a = a->next) {
            if (a->line_num == CurLine) {
                int len = a->extent, n = a->number, start = a->line_pos;
                int end = start + len;




; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]