A couple of questions on C#
- Does C# support runtime inlining?
- Does JIT’s optimizate before or during the execution of the code?
- Can a virtual function be inlined?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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. 😛 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.