Re: [Htmlparser-developer] Java Performance question
Brought to you by:
derrickoswald
From: Derrick O. <Der...@ro...> - 2003-01-20 13:20:35
|
Somik, My instincts would say to use the simplest mechanism possible. In this case it would be instanceof, since the getType() way involves extra fields and accessor methods. But what problem are you trying to solve? Is it the "if (node instanceof HTMLLinkTag)" that seems to be needed everywhere? Perhaps HTMLNode should have a "getLink()" method that returns null but is overridden in HTMLLinkTag? Similarly, rationalization of toString(), getPlainTextString(), getHTML() and any required new methods to return appropriate renditions of the text within the node could eliminate the instanceof operations in StringExtractor and elsewhere. My $0.02 worth. Derrick Somik Raha wrote: >Hi Derrick, > It was really nice to read your reply. I tried a more accurate test (no, >I didnt include instanceof HTMLNode, as our matches are at most one level >up). The results (attached graph) show that it is almost the same - there is >no perceivable improvement in this case. I guess if one goes a couple of >layers up, the benefits would start to show. > > Which brings me to the next question - knowing that we have no >perceptible improvement to gain, should we recommend the use of the >object-oriented way ? > >Regards, >Somik > >----- Original Message ----- >From: "Derrick Oswald" <Der...@ro...> >To: <htm...@li...> >Sent: Saturday, January 18, 2003 6:36 AM >Subject: Re: [Htmlparser-developer] Java Performance question > > |