lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev [PATCH 2.8.5-dev14] Linear-time lynx load


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.5-dev14] Linear-time lynx load
Date: Wed, 19 Feb 2003 00:21:38 -0800
User-agent: Mutt/1.4i

With this patch loading of pages with Lynx becomes linear-time (as
opposed to quadratic time).  Tested with

<html><head><title>Upload</title>
</head>
<body>

<table>

<tr><td><a href="/">1</a></td><td><a href="/">1</a></td></tr>
<tr><td><a href="/">2</a></td><td><a href="/">2</a></td></tr>
<tr><td><a href="/">3</a></td><td><a href="/">3</a></td></tr>
....
<tr><td><a href="/">99998</a></td><td><a href="/">99998</a></td></tr>
<tr><td><a href="/">99999</a></td><td><a href="/">99999</a></td></tr>
<tr><td><a href="/">100000</a></td><td><a href="/">100000</a></td></tr>



</table>

</body></html>

If you know a situation when the loading time is not linear, please
let me know.

Best regards,
Ilya

--- ./src/TRSTable.c~   Sat Jul  7 17:30:12 2001
+++ ./src/TRSTable.c    Tue Feb 18 23:28:36 2003
@@ -1905,11 +1905,18 @@ PUBLIC int Stbl_getFixupPositions ARGS4(
     STable_rowinfo * row;
     int j;
     int ninserts = -1;
+    static int prev_row = 0;
+
     if (!me || !me->nrows)
        return -1;
-    for (j = 0; j < me->nrows; j++) {
+    if (prev_row < me->nrows && me->rows[prev_row].Line <= lineno) 
+       j = prev_row;
+    else
+       j = 0;
+    for (j; j < me->nrows; j++) {
        row = me->rows + j;
        if (row->Line == lineno) {
+           prev_row = j;
            ninserts = get_fixup_positions(row, oldpos, newpos,
                                           me->sumcols);
            break;

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

reply via email to

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