Re: HTRDF.c parser performance improvement

I had sent this earlier, but did not see it in the lists.  In any case, 
here it is again . . .

Brown, David wrote:

>I've been using the libwww HTRDF component for parsing files. I made a
>recent change (diff of HTRDF.c output below) that has improved the
>parsing process. In my case, parsing time went from 74 minutes to 4
>minutes on a file with a 300K elements. 
>
Nice, you added a member to the structure to track the end of the list !
We could likely do a list processing hunt and make this optimization in 
various other places . . .

>can someone put this into the CVS repository?
>  
>
Sure, the full diff would include the structure change and initial 
assignment for a new element,

   Index: HTRDF.c
   ===================================================================
   RCS file: /sources/public/libwww/Library/src/HTRDF.c,v
   retrieving revision 2.12
   diff -r2.12 HTRDF.c
   48a49
    >     HTList *                  m_lastChild;
   233a235
    >       me->m_lastChild = me->m_children;
   253a256
    >       me->m_lastChild = me->m_children;
   293c296,303
   <     return (me && element) ? HTList_appendObject(me->m_children,
   element) : NO;
   ---
    >   if (me && element) {
    >     HTList *lastChild;
    >     if ((lastChild = HTList_addList(me->m_lastChild, element))) {
    >       me->m_lastChild = lastChild;
    >       return YES;
    >     }
    >   }
    >   return NO;

This resulting in the following revision,

   Checking in HTRDF.c;
   /sources/public/libwww/Library/src/HTRDF.c,v  <--  HTRDF.c
   new revision: 2.13; previous revision: 2.12
   done

more,
l8r,
v

-- 
"The future is here. It's just not evenly distributed yet."
 -- William Gibson, quoted by Whitfield Diffie

Received on Tuesday, 7 February 2006 14:38:45 UTC