You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Vincent Finn <vi...@automsoft.com> on 2004/03/18 15:57:48 UTC

SAX v DOM speed

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

------------------------------------------------------------------------
vincent.finn@automsoft.com
------------------------------------------------------------------------
My opinions may have changed, but not the fact that I am right.
------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: SAX v DOM speed

Posted by Gareth Reakes <pa...@parthenoncomputing.com>.
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
>
> ------------------------------------------------------------------------
> vincent.finn@automsoft.com
> ------------------------------------------------------------------------
> My opinions may have changed, but not the fact that I am right.
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org