473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Transformations appear to be CPU intensive

I am migrating an existing ASP app that uses XSLT transformations to render against a language XML doc for localization and other items. When I moved this logic into .NET and the native xml and xsl objects I noticed a significant processor hit on the web machine.

The xml file is roughly 110KB and the XSLT files, the called transformation has several includes, is in total about 20KB. I have run the application test center on the page which contains the below code and it seems to indicate resonable response times but the web server CPU in task manager is pegged at 100%. Even individual requests when run via the browser peg the process. I have narrowed it down to transformations as a page that does not contain any transforamtions barely tweaks the processor. Below is the VB code, if I remove the transform line then the page again barely tweaks the CPU in task manager.

Dim objXML As New XmlDataDocument()
objXML.Load(Server.MapPath("shared/x/siteData.xml"))

Dim objXSL As New XslTransform()
objXSL.Load(Server.MapPath("scripts/clnt.home.body.xslt"))
objXSL.Transform(objXML, Nothing, Response.OutputStream)
objXML = Nothing
objXSL = Nothing

Is there a known issue with transformation or is there a better way of doing this. Of interest when I used MSXML4.0 in .NET I did not get this problem even though MS states you should not use it.

Any thought?

Keith Chadwick

PS: I will be using Page caching to reduce the server load but still would like to know whats up?
Nov 12 '05 #1
5 2544
Keith Chadwick wrote:
Dim objXML As New XmlDataDocument()
objXML.Load(Server.MapPath("shared/x/siteData.xml"))

Dim objXSL As New XslTransform()
objXSL.Load(Server.MapPath("scripts/clnt.home.body.xslt"))
objXSL.Transform(objXML, Nothing, Response.OutputStream)
objXML = Nothing
objXSL = Nothing


XmlDataDocument is slow for XSLT, use XPathDocument instead - it's much
faster and has lesser memory footprint.
And cache compiled XslTransform, because Load() operation isn't cheap,
but once stylesheet is loaded (hence compiled) you can call its
Transform() method as many times your need and in as many thread you want.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #2
Thanks Oleg,

When you mentioned the cache I assume you mean placing the XslTransform
'object' within the context.cache

cheers
keith

"Oleg Tkachenko" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Keith Chadwick wrote:
Dim objXML As New XmlDataDocument()
objXML.Load(Server.MapPath("shared/x/siteData.xml"))

Dim objXSL As New XslTransform()
objXSL.Load(Server.MapPath("scripts/clnt.home.body.xslt"))
objXSL.Transform(objXML, Nothing, Response.OutputStream)
objXML = Nothing
objXSL = Nothing


XmlDataDocument is slow for XSLT, use XPathDocument instead - it's much
faster and has lesser memory footprint.
And cache compiled XslTransform, because Load() operation isn't cheap,
but once stylesheet is loaded (hence compiled) you can call its
Transform() method as many times your need and in as many thread you want.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #3
just implemented your suggestion Oleg, bloody brilliant cheers!! much much
better performance.

Keith

"Oleg Tkachenko" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Keith Chadwick wrote:
Dim objXML As New XmlDataDocument()
objXML.Load(Server.MapPath("shared/x/siteData.xml"))

Dim objXSL As New XslTransform()
objXSL.Load(Server.MapPath("scripts/clnt.home.body.xslt"))
objXSL.Transform(objXML, Nothing, Response.OutputStream)
objXML = Nothing
objXSL = Nothing


XmlDataDocument is slow for XSLT, use XPathDocument instead - it's much
faster and has lesser memory footprint.
And cache compiled XslTransform, because Load() operation isn't cheap,
but once stylesheet is loaded (hence compiled) you can call its
Transform() method as many times your need and in as many thread you want.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #4
Keith Chadwick wrote:
When you mentioned the cache I assume you mean placing the XslTransform
'object' within the context.cache


In ASP.NET - exactly, in other environment - by other means.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #5
> much much better performance.

Ofcourse! :-)

--
venlig hilsen / with regards
anders borum
--
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike | last post by:
I am trying to code vb.net to perform XML transformations by applying a style sheet to a XML doc. All of my XML and XSLT documents will be in either XML DOM Objects or string variables. I am not...
0
by: Franck Perrin | last post by:
I'd like to know if there is a way to apply to successive XSL transformations on one XML file. I got this XML file : <page Action="N047"> <data defaultName="c0dos010" Type="String"...
6
by: Christopher | last post by:
I am currently in the process of evaluating the performance hits of moving to the .NET platform for our application. I created a sample project that loads the transforms the same XML and XSLT in...
1
by: George Durzi | last post by:
Folks, I'm running into some performance issues with my Xsl transformations. I've done a ton of debugging and digging around, and have come to the conclusion that the performance issues are NOT...
0
by: Glenn Engelbart | last post by:
I am trying to find out a way to get more code re-use & object orientation in the UI portion of my apps. (There already is plenty of both in the DataAccess & Business Logic portion of my apps. ...
0
by: Alain Frisch | last post by:
Hello, I'd like to announce a new small language for XML transformation, called XStream. Transformations written in XStream are compiled into efficient XML stream processors: the output is...
3
by: CyberSpyders | last post by:
Hi, I have an ASP.Net website, which allows users to upload a file which is then inserted into a database. This is all fine until it reads a line with the string +Anu in it. It transforms...
0
by: Hoax | last post by:
I didn't see a forum for OpenGL so i assume it would go here. I've having an issues with my camera interfering with the transformations of my geometry. Here is my Display() code, I think it's...
1
by: Rain | last post by:
Hi I need to do some transformations using the following class. System.Xml.Xsl.XslCompiledTransform I have successfully managed to get it to work. The only thing i cant work out is how to how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.