Subject: RE: [xsl] How to speed up parsing ?? From: Dipesh Khakhkhar <dkhakhkh@xxxxxxxxxxxxxxx> Date: Fri, 1 Aug 2003 14:47:25 -0400 |
Hi, Thanks for replying and giving valuable suggestions. Well as Mukul said i tried to use xsltc. As per the latest documentation of xalan they have merged the Xalan Interpretive and Xalan Compiler processor we need only xalan.jar for comiling and getting translets. I gave the class path properly for xalan.jar and other files but it seems it is not recognizing it. I have to look where i m getting wrong. Further i tried to run only the xalan.xslt.Process and it is running fine. BUT THIS TOOK MORE TIME THAN MY ORIGINAL PARSER PROGRAM. AS I PUT HERE BEFORE USING A FREE XML EDITOR TOOL i.e. COOKTOP which PROVIDES TRASFORMATION ENGINE AS WELL DOES THE SAME THING IN LESS THAN A MINUTE. IT IS USING MSXML AS XSLT ENGINE. SO IS IT LIKE THAT I HAVE TO USE THAT ONLY TO DO THIS. ULTIMATELY I WANT TO USE SOME ENGINE TO WHICH I SHOULD BE ABLE TO PROVIDE COMMAND LIKE ENGINEORUTILITY XMLFILENAME XSLFILENAME OUTPUTFILENAME I have not worked with MSXML. Can anybody please tell me how do i invoke MSXML engine from command line ?? So Mukul, i can't meauser performance between Process and cmdline.Compile process classes of xalan. Something is wrong. But Process is much slower to do this task. As Ashish has said to create and instance of DOM Parser and then do this thing. I will try that too. Original code which i m using is a wrapper utility like that only. I m not sure which engine exactl it is invoking. I was told that it is internally using oracle parser. Will find out more about it. Well i m not having extra white spaces and comments are very few. Still i will try to reduce that. Eagerly waiting for any suggestion to use MSXSL XSLT engine. Thanks a lot for all the replies. Regards, Dipesh ------------------------------ Date: Fri, 1 Aug 2003 08:17:07 -0700 (PDT) From: Mukul Gandhi <mukulw3@xxxxxxxxx> Subject: RE: [xsl] How to speed up parsing ?? Hi Dipesh, You can also try XSLTC.. Its a Xalan-J module which allows you to convert the XSL file into Java classes. These Java classes are called translets. You can then apply these translets(Java classes) to XML files to produce final output. Please see http://xml.apache.org/xalan-j/xsltc_usage.html for details about XSLTC. It *may* enhance the performance of your transformations.. i don'nt know for sure about the performance difference XSLTC has over xalan.xslt.Process (the normal way of invoking XSL transformation from Xalan).. You may try it and report to us if it speeds up transformation. i would suggest , that please try both xalan.xslt.Process and XSLTC and observe the time difference.. If somebody has information about performance difference between XSLTC and usual Xalan transformation, i would also be eager to know it.. Regards, Mukul --------------------------------------------------------------- Date: Fri, 1 Aug 2003 11:13:09 -0500 From: "Tengshe, Ashish" <Tengshe.Ashish@xxxxxxxxxxxxx> Subject: RE: [xsl] How to speed up parsing ?? OK, it seems like you are using Java right? (java -ms25M -mx100M xslFileName xmlFileName > directingOutput.txt) You can parse the document and create a Document object DOMParser parser = new DOMParser(); parser.parse("D:/foo.xml"); /* You can parse a File or an InputSource, if you have InputStream then just do InputSource s = new InputSource(InputStream) thing. */ Document document = parser.getDocument(); This Document object is parsed XML. You should store this in memory (Session/whatever else)if you repeatedly need it! Also if you repeatedly need the same XSL file you should use some caching mechanism. Also, XSL files after parsing can be represented by Templates objects TransformerFactory tFactory = TransformerFactory.newInstance(); Templates t = tFactory.newTemplates(xslSource); Transformer transformer = t.newTransformer(); these Templates object can be stored in a HashTable in session or something and retrieved when this particular XSL is called again. This will reduce time. If you need more info, please mail me directly at tengshe.ashish@xxxxxxxxxxxxx Lastly, try Translets, I've had better results working with large documents (Refer to Mukul Gandhi's post XSLTC) Thanks, Ashish XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list ------------------------------ Date: Fri, 1 Aug 2003 10:14:03 -0600 (MDT) From: Mike Brown <mike@xxxxxxxx> Subject: Re: [xsl] How to speed up parsing ?? Tengshe, Ashish wrote: > This may not be relevant to you but I thought I'd just post these performance tips, Very nice list there. A few years ago, I benchmarked slight improvements in XML parsing speed and memory overhead when I removed extraneous whitespace and comments from very large stylesheets. XSLT processors tend to keep the original stylesheet tree (before whitespace stripping) in memory so that document('') will work, so anything you can do to squeeze extra nodes out of that tree will free up some RAM. The stylesheets probably won't run any faster, but their load time and memory consumption will be reduced. See http://skew.org/xml/stylesheets/condense/ for an example of a stylesheet that I used to produce 'condensed' stylesheets. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to speed up parsing ?, Mike Brown | Thread | RE: [xsl] How to speed up parsing ?, Craig Kattner |
Re: [xsl] for-each, J.Pietschmann | Date | RE: [xsl] How to speed up parsing ?, Craig Kattner |
Month |