Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Urgent Help: Sloooow XSLT blue


Message #1 by "Tangent" <tangent@u...> on Mon, 18 Feb 2002 00:01:58 -0600
Hi,



I used C# and wrote a function that translate an XmlDataDocument to HTML

using XSLT.  The XML source is somewhere around 12KB, and the XSLT is

not complicated, but the function takes about 12 seconds to execute.  I

have tried with StringWriter, I have no luck.  I know the bottle neck is

not at XSTL transform, because it took no more than 1/10 of a second

using file output or regular MSXML.  Anyone has some suggestions?



Thanks!



- Tangent





		public static String Transform(XmlDataDocument doc,

string path)

		{

			DateTime timer = DateTime.Now;

			XPathNavigator nav 

doc.DocumentElement.CreateNavigator();

			XslTransform xslt = new XslTransform();



			xslt.Load(path);

			MemoryStream outputStream = new MemoryStream();

			xslt.Transform(nav, null, outputStream);



			outputStream.Flush();

			outputStream.Seek(0, SeekOrigin.Begin);



			StreamReader reader = new

StreamReader(outputStream);

			return reader.ReadToEnd();

			

		}



Message #2 by "Scott Guthrie" <scottgu@m...> on Sun, 17 Feb 2002 23:35:14 -0800
There are some real .NET XML experts on the dedicated XML listserv at:

http://www.asplists.com/asplists/aspngxml.asp



Might be worth posting the code and asking there as well (might be able

to get some additional eyes looking at the problem).



Hope this helps,



Scott



-----Original Message-----

From: Tangent [mailto:tangent@u...]

Sent: Sunday, February 17, 2002 10:02 PM

To: ASP+

Subject: [aspx] Urgent Help: Sloooow XSLT blue





Hi,



I used C# and wrote a function that translate an XmlDataDocument to HTML

using XSLT.  The XML source is somewhere around 12KB, and the XSLT is

not complicated, but the function takes about 12 seconds to execute.  I

have tried with StringWriter, I have no luck.  I know the bottle neck is

not at XSTL transform, because it took no more than 1/10 of a second

using file output or regular MSXML.  Anyone has some suggestions?



Thanks!



- Tangent





		public static String Transform(XmlDataDocument doc,

string path)

		{

			DateTime timer =3D DateTime.Now;

			XPathNavigator nav =3D

doc.DocumentElement.CreateNavigator();

			XslTransform xslt =3D new XslTransform();



			xslt.Load(path);

			MemoryStream outputStream =3D new MemoryStream();

			xslt.Transform(nav, null, outputStream);



			outputStream.Flush();

			outputStream.Seek(0, SeekOrigin.Begin);



			StreamReader reader =3D new

StreamReader(outputStream);

			return reader.ReadToEnd();

		=09

		}








Message #3 by "Tangent" <tangent@u...> on Mon, 25 Feb 2002 02:34:50 -0600
Hi list,



After dealing with the trouble for weeks, I came to a conclusion that

System.Xml.Xsl is very slow!  I even tried asp:xml and it offered no

advantage.  Here is the behavior



	xml:  a 26k xml file from a dataset of two master-detail tables

	xsl:	a small xslt file

	output: a 78k html from the two above



Running with System.Xml.Xsl, CPU is charged about 100% for 9 seconds,

and the entire execution takes about 12 seconds on my 500Mhz laptop with

288MB of RAM.



Running with MSXML 4.0 via .Net, CPU topped at 65%, and only 1.5 seconds

of execution.



Just my 2 cents from my 4-day experiment.  Send me a box of chocolate if

you run into this problem and my solution helps.



- Tangent





> -----Original Message-----

> From: Scott Guthrie [mailto:scottgu@m...] 

> Sent: Monday, February 18, 2002 1:35 AM

> To: ASP+

> Subject: [aspx] RE: Urgent Help: Sloooow XSLT blue

> 

> 

> There are some real .NET XML experts on the dedicated XML 

> listserv at: http://www.asplists.com/asplists/aspngxml.asp

> 

> Might be worth posting the code and asking there as well 

> (might be able to get some additional eyes looking at the problem).

> 

> Hope this helps,

> 

> Scott

> 

> -----Original Message-----

> From: Tangent [mailto:tangent@u...] 

> Sent: Sunday, February 17, 2002 10:02 PM

> To: ASP+

> Subject: [aspx] Urgent Help: Sloooow XSLT blue

> 

> 

> Hi,

> 

> I used C# and wrote a function that translate an 

> XmlDataDocument to HTML using XSLT.  The XML source is 

> somewhere around 12KB, and the XSLT is not complicated, but 

> the function takes about 12 seconds to execute.  I have tried 

> with StringWriter, I have no luck.  I know the bottle neck is 

> not at XSTL transform, because it took no more than 1/10 of a 

> second using file output or regular MSXML.  Anyone has some 

> suggestions?

> 

> Thanks!

> 

> - Tangent

> 

> 

> 		public static String Transform(XmlDataDocument doc,

> string path)

> 		{

> 			DateTime timer = DateTime.Now;

> 			XPathNavigator nav 

> doc.DocumentElement.CreateNavigator();

> 			XslTransform xslt = new XslTransform();

> 

> 			xslt.Load(path);

> 			MemoryStream outputStream = new MemoryStream();

> 			xslt.Transform(nav, null, outputStream);

> 

> 			outputStream.Flush();

> 			outputStream.Seek(0, SeekOrigin.Begin);

> 

> 			StreamReader reader = new

> StreamReader(outputStream);

> 			return reader.ReadToEnd();

> 			

> 		}

> 

> 




> 




> 

> 

> 

> 




  Return to Index