.net - XQSharp XSLT2 performance tuning -
i have real time application uses xslt1 , want upgrade xslt2. using microsoft xslt1 engine performs specific xml , xsl within 0.1 second.
for xslt2 transformation created function uses xqsharp perform xslt2 transformation. used same xml , xsl , transformation took 0.9 second.
i analyzed code , turns out more 90% of processing time caused line :
dim query xslt = xslt.compile(new stringreader(inputxsl), querysettings)
my question of there way speed process ?
for example changing querysettings?
my full code
<webmethod()> _ public function xsltxqsharp(byval inputxml string, byval inputxsl string) string dim nametable xmlnametable = new nametable() dim xmlreadersettings new xmlreadersettings() xmlreadersettings.nametable = nametable dim document xdmdocument using reader new stringreader(inputxml) using xmlreader xmlreader = xmlreader.create(reader, xmlreadersettings) document = new xdmdocument(xmlreader) end using end using dim querysettings new xsltsettings(nametable) querysettings.contextitemtype = xdmtype.node querysettings.moduleresolver = new xmlurlresolver() ''' slow!!! more 90 % of execution time dim query xslt = xslt.compile(new stringreader(inputxsl), querysettings) dim contextitem xpathnavigator = document.createnavigator() dim result stream = new memorystream() query.applytemplates(contextitem, result) 'return dt2.subtract(dt1).tostring() result.position = 0 using reader streamreader = new streamreader(result) return reader.readtoend() end using end function
try changing optimization level. it's property on static context settings. helpful see transformation trying compile.
note microsoft compiler pretty quick, , compiles byte code. xqsharp tends win more complex stylesheets, or xslt 2.0 features (e.g. for-each-group) replacing use of keys in xslt 1.0.
Comments
Post a Comment