HTRDF.c parser performance improvement

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

HTRDF.c parser performance improvement

Brown, David

Good day,

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. I am not an official hacker and do not have write access to the CVS repository. So I offer my contribution via this email. The fix is based on the latest HTRDF.c file. I attached the updated HTRDF.c file for your revision. Assuming this is 'hacker approved', can someone put this into the CVS repository?

Regards,

David Brown

 

>     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;


HTRDF.zip (25K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: HTRDF.c parser performance improvement

Vic Bancroft-2

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