在C#中运行时内联? [英] Run Time Inlining in C#?

查看:334
本文介绍了在C#中运行时内联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一对夫妇对C#问题




  1. 是否支持C#运行时内联?

  2. 是否JIT的之前或代码的执行期间optimizate?

  3. 可以在虚拟函数内联?


解决方案

C#语言没有做内联,但.NET CLR JIT编译器。



VIRTUALS可能是内联能够在一个密封类,但我不肯定非密封类。我假设没有。



JIT代码的执行,当函数首先调用之前优化。因为之前的JIT上班,你没有任何代码来执行。 :P。JIT在第一次调用只发生一次给一个函数,而不是每次调用函数



还请注意,内联只是一个程序集内完成(DLL) 。 JIT编译器将不会从另一个程序集复制代码,它内联到本次大会的代码。


A couple of questions on C#

  1. Does C# support runtime inlining?
  2. Does JIT's optimizate before or during the execution of the code?
  3. Can a virtual function be inlined?

解决方案

C# the language doesn't do inlining, but the .NET CLR JIT compiler can.

Virtuals might be inline-able in a sealed class, but I'm not sure about non-sealed classes. I would assume not.

JIT optimizes before the execution of the code, when a function is first called. Because before the JIT goes to work, you don't have any code to execute. :P JIT happens only once on the first call to a function, not on every call to the function.

Note also that inlining is only done within an assembly (DLL). The JIT compiler will not copy code from another assembly to inline it into the code of this assembly.

这篇关于在C#中运行时内联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆