XslCompiledTransform 最快的内存缓存

发布于 2024-07-14 12:30:11 字数 377 浏览 5 评论 0原文

我有一组 xslt 样式表文件。 我需要产生最快的 XslConpiledTransform 性能,因此我想在内存中表示这些样式表。

我可以在应用程序启动时将它们作为 IXpathNavigable 加载到内存集合中,然后根据每个请求将每个 IXPAthNavigable 加载到单例 XslCompiledTransform 中。 但这仅适用于没有 xsl:import 或 xsl:include 的 styleshhets。 (Xsl:import 仅适用于文件)。

我还可以将每个模板的许多 XSLCompiledTransform 实例加载到缓存中。 合理吗?

还有其他方法吗? 哪个最好? 提高 MS Xslt 处理器性能的其他技巧是什么?

I have a set of xslt stylesheet files. I need to produce the fastest performance of XslConpiledTransform, so i want to make in-memory representation of these stylesheets.

I can load them to in-memory collection as IXpathNavigable on application start, and then load each IXPAthNavigable into singleton XslCompiledTransform on each request.
But this works only for styleshhets without xsl:import or xsl:include. (Xsl:import is only for files).

also i can load into cache many instances of XSLCompiledTransform for each template. Is it reasonable?

Are there other ways? What is the best? what are another tips for improving performance MS Xslt processor?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅忆 2024-07-21 12:30:11

成功执行Load()XslCompiledTransform,可以缓存此实例以获得更好的性能

请记住 Load() 是一个非常昂贵的操作。

After the successful execution of Load() on an instance of XslCompiledTransform, this instance can be cached in order to achieve better performance.

Do remember that Load() is a very expensive operation.

薄凉少年不暖心 2024-07-21 12:30:11

您可以使用 MS SDK 工具 xsltc.exe(XSL 编译器)来生成程序集,而不是在运行时编译和缓存 XSL 转换。

在运行时,您的应用程序将动态加载这些程序集(或者您可以仅向应用程序添加静态引用)并调用重载的 XslCompiledTransform.Load(System.Type type) 方法来加载您编译到 XSL 程序集中的类型。

这绝对是最快的方法,因为您不会招致运行时的编译损失 - 仅在构建/编译时。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文