Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Very Slow XSLTransform with XPathDocument

Reply
Thread Tools

Very Slow XSLTransform with XPathDocument

 
 
=?Utf-8?B?U2VhbiBIb2ZmbWFu?=
Guest
Posts: n/a
 
      11-18-2004
Framework 1.1 SP1.

Page.xml is about 1.5mg. m_oXSLTransform.Transform takes about 2 minutes.

When Page.xml is trimmed down to a smaller doc, it takes about 2 seconds.

Same code ran in about 4 seconds under asp.

not using <xsl:key>.

XslTransform m_oXSLTransform = new XslTransform();
m_oXSLTransform.Load("\default.xsl");
XPathDocument m_oXMLDocument = new XPathDocument("Page.xml");
XsltArgumentList xslArg = new XsltArgumentList();
m_oXSLTransform.Transform(m_oXMLDocument,xslArg,
context.Response.OutputStream);
 
Reply With Quote
 
 
 
 
=?Utf-8?B?YWRvbGYgZ2FybGlj?=
Guest
Posts: n/a
 
      11-18-2004
As an xml doc is expanded into memory ( from the text string or file) it can
become enormous, so if it is already 1.5 mb it could be as big as 6mb in
memory (i think x4 is a rule of thumb)

what you may have to do is look at using one of the other objects to process
your doc e.g. sax (is this called xmlreader in .net? i forget) but basically
this processes the xml doc as a long stream, throwing out all that it has
processed up to a given point, it just raises a bunch of events for each
thing it finds

or

get a big fast box

"Sean Hoffman" wrote:

> Framework 1.1 SP1.
>
> Page.xml is about 1.5mg. m_oXSLTransform.Transform takes about 2 minutes.
>
> When Page.xml is trimmed down to a smaller doc, it takes about 2 seconds.
>
> Same code ran in about 4 seconds under asp.
>
> not using <xsl:key>.
>
> XslTransform m_oXSLTransform = new XslTransform();
> m_oXSLTransform.Load("\default.xsl");
> XPathDocument m_oXMLDocument = new XPathDocument("Page.xml");
> XsltArgumentList xslArg = new XsltArgumentList();
> m_oXSLTransform.Transform(m_oXMLDocument,xslArg,
> context.Response.OutputStream);

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2VhbiBIb2ZmbWFu?=
Guest
Posts: n/a
 
      11-18-2004
Something like this?:
XmlReader m_oXMReader = new XmlTextReader("Page.xml");
XslTransform m_oXSLTransform = new XslTransform();
m_oXSLTransform.Load("\default.xsl");
XPathDocument m_oXMLDocument = new XPathDocument(m_oXMReader);
XsltArgumentList xslArg = new XsltArgumentList();
m_oXSLTransform.Transform(m_oXMLDocument ,xslArg,
context.Response.OutputStream);

MACHINE IS ALREADY BIG AND FAST!
 
Reply With Quote
 
=?Utf-8?B?YWRvbGYgZ2FybGlj?=
Guest
Posts: n/a
 
      11-18-2004

hmmm not sure

DOM (aka xml document, xml data document)
this gives you a random access object that you can fully traverse
fast but 'expensive'

SAX (aka ? )
gives a foward only stream of xml which fires off events
(i only ever played around with this a bit in msxml)
e.g. series of events such as
elementfound,attribute found,attribute found, end of element found

you then needed to (in msxml at least)
implement an interface for each of these events that could be fired,
which in my example ended up as a big event handler with a massive case
statement

i'm not sure this helps you

i'm not even sure why you are trying to process such a huge xml doc in this
manner

why are you trying to do it out of interest?





"Sean Hoffman" wrote:

> Something like this?:
> XmlReader m_oXMReader = new XmlTextReader("Page.xml");
> XslTransform m_oXSLTransform = new XslTransform();
> m_oXSLTransform.Load("\default.xsl");
> XPathDocument m_oXMLDocument = new XPathDocument(m_oXMReader);
> XsltArgumentList xslArg = new XsltArgumentList();
> m_oXSLTransform.Transform(m_oXMLDocument ,xslArg,
> context.Response.OutputStream);
>
> MACHINE IS ALREADY BIG AND FAST!

 
Reply With Quote
 
=?Utf-8?B?U2VhbiBIb2ZmbWFu?=
Guest
Posts: n/a
 
      11-18-2004
web site is based on xml files stored in file a system with an xml <sitemap>
that stores the structure. The sitemap is very large and needed for the
presentation layer(xsl).

a future goal is to cut the page.xml down to only what the current xsl
demands, but for now it takes the whole sitemap. works fine in asp.

thx.

"adolf garlic" wrote:

>
> hmmm not sure
>
> DOM (aka xml document, xml data document)
> this gives you a random access object that you can fully traverse
> fast but 'expensive'
>
> SAX (aka ? )
> gives a foward only stream of xml which fires off events
> (i only ever played around with this a bit in msxml)
> e.g. series of events such as
> elementfound,attribute found,attribute found, end of element found
>
> you then needed to (in msxml at least)
> implement an interface for each of these events that could be fired,
> which in my example ended up as a big event handler with a massive case
> statement
>
> i'm not sure this helps you
>
> i'm not even sure why you are trying to process such a huge xml doc in this
> manner
>
> why are you trying to do it out of interest?
>
>
>
>
>
> "Sean Hoffman" wrote:
>
> > Something like this?:
> > XmlReader m_oXMReader = new XmlTextReader("Page.xml");
> > XslTransform m_oXSLTransform = new XslTransform();
> > m_oXSLTransform.Load("\default.xsl");
> > XPathDocument m_oXMLDocument = new XPathDocument(m_oXMReader);
> > XsltArgumentList xslArg = new XsltArgumentList();
> > m_oXSLTransform.Transform(m_oXMLDocument ,xslArg,
> > context.Response.OutputStream);
> >
> > MACHINE IS ALREADY BIG AND FAST!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RSS, XPathDocument and ISA proxy server ThatsIT.net.au ASP .Net 0 03-24-2007 05:02 AM
Quick Book file access very very very slow Thomas Reed Computer Support 7 04-09-2004 08:09 PM
Placing dataset into XPathDocument Keith Chadwick ASP .Net 4 11-24-2003 12:57 PM
XPathDocument srikar ASP .Net 2 10-25-2003 11:51 PM
trying to instantiate XPathDocument with MemoryStream D ASP .Net 2 10-16-2003 02:18 AM



Advertisments