That seems obvious once you mention it!! I tweaked the feature and got some substantial improvement it's now about 10% slower rather than 25%
Still slower though which is what confuses me > -----Original Message----- > From: George M. Feinberg [mailto:[EMAIL PROTECTED] > Sent: 18 March 2004 15:26 > To: Vincent Finn > Subject: Fwd: SAX v DOM speed > > > > Make sure you're using the same scanner for both > DOM and SAX, as well as turning on/off the same > flags (validation, namespaces, etc). I'm not a Xerces expert, but > the defaults for SAX and DOM may not be the same. > > George > > Begin forwarded message: > > > From: "Vincent Finn" <[EMAIL PROTECTED]> > > Date: March 18, 2004 10:21:17 AM EST > > To: <[EMAIL PROTECTED]> > > Subject: RE: SAX v DOM speed > > Reply-To: [EMAIL PROTECTED] > > > > That's what I was expecting. That's what worries me > > > > I don't do much in the events. > > I copy the pointer for element names and the string for text > > and a small bit of management to make sure there are no > leaks or other > > nastiness > > I am doing a progressive parse but I wouldn't have thought > that would > > matter > > > > just as an example here is the code I have in the > characters function > > this is as complex as it gets > > > > I copy the data into a vector of chars and set a variable > > the vector is only ever cleared (not fully released) > > so once the memory has been got once it will remain > available for the > > next time > > > > //////////////////////////////////// > > if (m_LastEvent != eventTextElement_e) > > { > > m_acData.assign(&pcText[0], &pcText[uiLength]); > > m_acData.push_back(L'\0'); > > } > > else > > { > > // insert infront of the '\0' > > m_acData.insert(--m_acData.end(), &pcText[0], > &pcText[uiLength]); > > } > > m_pcData = &m_acData[0]; > > m_LastEvent = eventTextElement_e; > > ////////////////////////// > > > >> -----Original Message----- > >> From: Gareth Reakes > >> [mailto:[EMAIL PROTECTED] Behalf > >> Of Gareth Reakes > >> Sent: 18 March 2004 15:08 > >> To: [EMAIL PROTECTED] > >> Subject: Re: SAX v DOM speed > >> > >> > >> Hi, > >> > >> You can view the creation of the DOM Tree as a sort of SAX > parse that > >> creates the objects that are required. If you are not doing > >> any heavy duty > >> work in the methods you have overriden I would expect it to be > >> significantly faster. > >> > >> > >> Gareth > >> > >> -- > >> Gareth Reakes, Managing Director +44-1865-811184 > >> Parthenon Computing http://www.parthcomp.com > >> > >> > >> > >> > >> On Thu, 18 Mar 2004, Vincent Finn wrote: > >> > >>> Hi, > >>> > >>> I have recently rewritten a class I have to use SAX instead > >> of the DOM > >>> I did this because the DOM tree was too large and was > >> taking Gigs of memory > >>> SAX takes far less memory but is slower > >>> > >>> I thought that SAX would be quicker since it seems to be > >> simpler and doesn't > >>> create any classes or internal structures. > >>> I can't see any inefficiencies in my code (obviously I have > >> to copy the text data > >>> since the pointer isn't valid outside the function, where > >> as in the DOM I'd just use it) > >>> so I am curious as to whether the DOM should be quicker > >>> > >>> Can anyone tell me why this might be so? > >>> Is this expected? > >>> > >>> The reason I ask is because if SAX would be expected to be > >> slower then that's > >>> fine and I'll leave it as is, memory is more important, > >>> but if it should be faster (or the same) I would like to > >> track down what I am doing wrong > >>> > >>> Vin > >>> > >>> > >> -------------------------------------------------------------- > >> ---------- > >>> [EMAIL PROTECTED] > >>> > >> -------------------------------------------------------------- > >> ---------- > >>> My opinions may have changed, but not the fact that I am right. > >>> > >> -------------------------------------------------------------- > >> ---------- > >>> > >>> > >> > --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: [EMAIL PROTECTED] > >>> For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >>> > >> > >> > --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]