lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev an optimization for large pages (patch)


From: Leonid Pauzner
Subject: Re: lynx-dev an optimization for large pages (patch)
Date: Fri, 18 Oct 2002 04:36:47 +0400 (MSD)

13-Oct-2002 19:02 I wrote:

> Anchores are stored in a list which is traversed each time we call a
> function. This is not a full story: anchors happens to be of two types:
> "with a tag" and "without a tag", both are stored in the same list, but
> the first force traversing list (=we add only unique tags to the list),
> while the second added to the list blindly. Don't ask me why.

Now I can bring some light on these two kinds of anchors:
in terms of HTML, "anchor with a tag" is  <a name="Somethig">header</a>,
and "anchor without a tag" is just  <a href=...>link</a>

If href=  anchor have a #fragment, it is still "without a tag",
but it will be linked to destination "anchor with tag=fragment"
(what is why search is required).

So they are really distinct and were mixed by mistake.
The attached patch tweaks comment in HTAnchor.h to save this knowledge
(words "if any" were omitted because of lack of space).


> So I replace the list with a tree (anchors with a tag) and a list
> (the rest, without tags). Search in a balanced tree is very effective.
> I added a search method to HTBTree implementation, it wasn't there.

> The resulting profile:
> -----------------------------------------------
>                 0.00    0.01    2687/6107        HTAnchor_findAddress [36]
>                 0.00    0.01    3420/6107        HTAnchor_findChildAndLink
> [33]
> [87]     0.1    0.00    0.01    6107         HTAnchor_findChild [87]
>                 0.00    0.01    3427/3427        HTChildAnchor_new [95]
>                 0.00    0.01    3168/6945        HTList_addObject [90]
>                 0.00    0.00     259/65969       HTSACopy [43]
>                 0.00    0.00     259/259         HTBTree_add [119]
>                 0.00    0.00       7/7           HTBTree_new [212]
>                 0.00    0.00       1/522         HTList_new [112]
>                 0.00    0.00    2932/2932        HTBTree_search [326]
> -----------------------------------------------


--- htanchor.h  Sun Oct 13 17:25:32 2002
+++ htanchor.new        Fri Oct 18 03:56:38 2002
@@ -53,8 +53,8 @@ struct _HTParentAnchor {
   HTParentAnchor * parent;     /* Parent of this anchor (self) */

   /* ParentAnchor-specific information */
-  HTList *     children_notag; /* Subanchors of this, if any. (tag is NULL) */
-  HTBTree *    children;       /* Subanchors ... sorted by nonNULL tag */
+  HTList *     children_notag; /* Subanchors <a href=...>, tag is NULL */
+  HTBTree *    children;       /* Subanchors <a name="tag">, sorted by tag */
   HTList *     sources;        /* List of anchors pointing to this, if any */
   HyperDoc *   document;       /* The document within which this is an anchor 
*/
   char *       address;        /* Absolute address of this node */



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

reply via email to

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