2

xsltスタイルシートファイルのセットがあります。XslConpiledTransformの最速のパフォーマンスを生成する必要があるため、これらのスタイルシートのメモリ内表現を作成したいと思います。

アプリケーションの起動時にIXpathNavigableとしてメモリ内コレクションにロードし、各要求で各IXPAthNavigableをシングルトンXslCompiledTransformにロードできます。ただし、これはxsl:importまたはxsl:includeのないstyleshhetsでのみ機能します。(Xsl:importはファイル専用です)。

また、テンプレートごとにXSLCompiledTransformの多くのインスタンスをキャッシュにロードできます。それは合理的ですか?

他の方法はありますか?一番良いのは何ですか?MS Xsltプロセッサのパフォーマンスを向上させるための別のヒントは何ですか?

4

2 に答える 2

3

Load()のインスタンスで が正常に実行された後、XslCompiledTransformパフォーマンスを向上させるために、このインスタンスをキャッシュできます

Load() は非常にコストのかかる操作であることを覚えておいてください。

于 2009-03-06T04:07:26.587 に答える
1

Instead of compiling and caching XSL transforms at run time you can use the MS SDK tool xsltc.exe (XSL compiler) to generate assemblies.

At runtime your application will then either load these assemblies dynamically (or you can just add static references to your application) and call the overloaded XslCompiledTransform.Load( System.Type type) method to load the type that you compiled into the XSL assembly.

This is the absolute fastest way since you dont incur the compile penalty of runtime - only at build/compile time.

于 2010-04-30T15:34:46.577 に答える