Hi,
        I can't find anything in the archives, but something to do with 
caching rung a bell in my mind. If you take a look in DOMDocumentImpl, 
you will see that we assign a 29 place table. After this is used up it 
doubles in size. I suggest you start the table very big and or adjust the 
algorithm that rehashes in RefHashTableOf.


Gareth


On Thu, 4 Sep 2003, Agrawal, Vikas (ELS) wrote:

> Thanks Gareth for your reply. I am using xml4c 2.2.0. You are right that it
> is just because of user data. Once I comment that line and code becomes
> fast. But I do need to set UserData. Could you suggest me what is the
> proposed solution to this.
> Thanks & Regards
> Vikas Agrawal
> 
> -----Original Message-----
> From: Gareth Reakes [mailto:[EMAIL PROTECTED]
> Sent: 04 September 2003 15:16
> To: [EMAIL PROTECTED]
> Subject: Re: DOMBuilder is terribly slow: need quick reply
> 
> 
> Hi,
>       I recall some discussion a while back about having lots of 
> userdata being very slow. Take out that line and reparse and if that is 
> the case then I will wrack my brain (or we could always look in the 
> archives). I recall a proposed solution to this as well. What version are 
> you using?
> 
> Gareth
> 
> 
> 
> On Thu, 4 Sep 2003, Agrawal, Vikas (ELS) wrote:
> 
> > Hi All,
> > 
> > I am using DOMBuilder as a parser to parse my 10 MB file and it is
> terribly
> > horribly slow. Could anybody suggest me how to improve perfomance. James
> > clark SP parser was used to take not more than a 30 seconds to parse this
> > file. DOMBuilder is taking around 20 minutes to parse my file if I
> override
> > the startElement function as follows. 
> > 
> > Normally DOMBuilder is also efficient and taking just 30 seconds if I do
> not
> > override the startElement function. I am wondering why is it adding
> another
> > 19 and half minutes in parsing time if I just override the startElement
> and
> > that is just to put node location information in the node user data.
> > 
> > Am I doing something wrong in the overridden startElement function below.
> > 
> > class EsDOMBuilderImpl : public DOMBuilderImpl 
> > 
> > void EsDOMBuilderImpl::startElement
> >     (
> >         const   XMLElementDecl&         elemDecl
> >         , const unsigned int            urlId
> >         , const XMLCh* const            elemPrefix
> >         , const RefVectorOf<XMLAttr>&   attrList
> >         , const unsigned int            attrCount
> >         , const bool                    isEmpty
> >         , const bool                    isRoot
> >     )
> > {
> >     const XMLCh* const                systemId = 0;
> >     
> >
> AbstractDOMParser::startElement(elemDecl,urlId,elemPrefix,attrList,attrCount
> > ,isEmpty,isRoot);
> >     XMLScanner* sc = this->getScanner();
> >     const Locator* loc = sc->getLocator();
> > 
> >     int lineNum = loc->getLineNumber();
> >     int colNum = loc->getColumnNumber();
> >     int offset = sc->getSrcOffset();
> >     DOMNode* node = this->getCurrentNode();
> >     DOMLocator* location = new  DOMLocatorImpl(lineNum, colNum,
> > getCurrentNode(), systemId);
> >     location->setOffset(offset);
> >     
> >     node->setUserData(locXmlStr_,location,0);
> > 
> >     DOMLocator* vlocator = (DOMLocator*)node->getUserData(locXmlStr_);
> >     return;
> > }
> > 
> > In the following way I am creating the parser
> > DOMBuilder* XmlDocumentTree::parserInstance()
> > {
> >     if(parserInstance_ == NULL)
> >     {
> >             static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
> >     
> >
> DOMImplementationRegistry::addSource((DOMImplementationSource*)EsDOMImplemen
> > tationImpl::getDOMImplementationImpl());
> >             DOMImplementation *impl =
> > DOMImplementationRegistry::getDOMImplementation(gLS);
> > 
> >             parserInstance_ =
> >
> ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYN
> > CHRONOUS, 0); // it returns EsDOMBuilderImpl class pointer.
> >             delete impl;
> >             parserInstance_->setFeature(XMLUni::fgDOMValidation, true);
> >             parserInstance_->setFeature(XMLUni::fgDOMNamespaces, false);
> >             //parserInstance_->setFeature(X("namespaces"), true);
> > 
> >             
> >             parserInstance_->setFeature(XMLUni::fgDOMEntities, false);
> >             parserInstance_->setFeature(XMLUni::fgXercesCalculateSrcOfs,
> > true);
> >     
> >
> ((EsDOMBuilderImpl*)parserInstance_)->setIncludeIgnorableWhitespace(false);
> >     }
> >     return parserInstance_;
> > }
> > 
> > I use it in the following way
> > 
> >             XMLPlatformUtils::Initialize();
> >             app->init();
> >             parser = parserInstance();
> > 
> >             errHandler_ = new EsDOMErrorHandler(warn);
> >             parserInstance_->setErrorHandler(errHandler_);
> > 
> >             entHandler_ = new EsXml4cDomEntityResolver();
> >             entHandler_->addDirToPath(env);
> >             parserInstance_->setEntityResolver(entHandler_);
> >             DOMDocument * doc = 0;
> >             doc = parser->parseURI(fname.c_str());
> >             node = doc->getDocumentElement();
> > 
> > Thanks & Regards
> > Vikas Agrawal
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to