减少 PostSharp 编译时间开销

发布于 2024-08-11 07:21:48 字数 351 浏览 10 评论 0原文

我们最近将 PostSharp 引入我们的代码库,我们的 ASP.NET MVC 项目的编译时间增加了一倍到四倍。我们的解决方案中有大约 3 个 MVC 项目和大约 8 个类库项目。

显然,PostSharp 会产生相关开销,因为它修改 MSIL 代码。但 2 倍到 4 倍的开销是相当大的开销。

这是 PostSharp 的典型情况吗?

We recently introduced PostSharp into our code base and the compile time of our ASP.NET MVC project has doubled to quadrupled. We have about 3 MVC projects and approximately 8 class library projects in our solution.

Obviously there will be overhead associated with PostSharp since it is modifying the MSIL code. But a 2x to 4x overhead is quite an overhead.

Is this typical with PostSharp?

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

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

发布评论

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

评论(3

梨涡 2024-08-18 07:21:48

对于您确定 PostSharp 不会执行任何注入的程序集,您可以在项目的构建选项卡上的条件编译符号中添加SkipPostSharp标志。

希望这有帮助。

For the assemblies where you are sure that PostSharp will not perform any injection you can add the flag SkipPostSharp in the Conditional compilation symbols on the Build Tab for the project.

Hope this helps.

本宫微胖 2024-08-18 07:21:48

2x 的典型开销是正常的。加速 PostSharp 1.5 的最重要方法是使用 ngenned 图像(安装程序会为您完成此操作)。在 PostSharp 2.0 中,ngenned 图像不再被认为那么重要。

如果您使用 PostSharp 2.0 确实有 4 倍的开销,我想对您的案例进行一些性能分析。

A typical overhead of 2x is normal. The most important way to speed up PostSharp 1.5 is to use ngenned images (the setup program does it for you). In PostSharp 2.0, ngenned images are not considered that important any more.

If you really have an overhead of 4x with PostSharp 2.0, I would like to make some performance analysis of your case.

念三年u 2024-08-18 07:21:48

对于 Visual Studio for Mac 社区版 v8.10,可以在“项目”->“项目”下完成此操作。选项->编译器->定义符号 ->将 SkipPostSharp 添加到“;”中分隔列表

For Visual Studio for Mac Community edition v8.10, this can be done under Project -> Options -> Compiler -> Define Symbols -> add SkipPostSharp into the ';' separated list

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