By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,683 Members | 1,398 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,683 IT Pros & Developers. It's quick & easy.

Inlining?

P: n/a
From what I can tell, VB.NET doesn't allow programmers to say
explicitly that they want a function to be inlined. Now, I'm a big fan
of factoring out duplicate code, but I don't want to do too much of it
in VB if there's going to be a noticeable performance hit. So:

1. Does the VB compiler sometimes inline simple functions?
2. Is there much of a performance hit on a function call?

Thanks.
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
1. Not that I know of, although it does inline constants from classes
instantiated within the calling class.
2. Not really. Instantiation is the real bugger in software, as
instantiating objects is the more expensive part.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Tony Vitonis" <no***@nowhere.com> wrote in message
news:_R********************@comcast.com...
From what I can tell, VB.NET doesn't allow programmers to say
explicitly that they want a function to be inlined. Now, I'm a big fan
of factoring out duplicate code, but I don't want to do too much of it
in VB if there's going to be a noticeable performance hit. So:

1. Does the VB compiler sometimes inline simple functions?
2. Is there much of a performance hit on a function call?

Thanks.

Nov 20 '05 #2

P: n/a
Tony,
1. Does the VB compiler sometimes inline simple functions? Neither VB.NET nor C# inline simple functions, per se.

The JIT compiler in the .NET runtime will inline simple functions when it
loads & compiles your code (at runtime)! The benefit of this approach is
that you will gain new optimizations by installing a new version of the
runtime, rather then needed to physically recompile your programs. This of
course assumes you allow your program to run on the new version of the
runtime (its configurable via the configuration files).
2. Is there much of a performance hit on a function call? I don't believe there is a noticeable performance hit. Generally you should
write good code first (avoid duplicate code). Then when you actually have a
performance problem you can refactor that routine so it performs better.

http://www.refactoring.com

The following articles provide information on writing .NET code that
performs well.

http://msdn.microsoft.com/library/de...anagedcode.asp

http://msdn.microsoft.com/library/de...anagedapps.asp

http://msdn.microsoft.com/library/de...vbnstrcatn.asp

http://msdn.microsoft.com/library/de...tchperfopt.asp

http://msdn.microsoft.com/library/de...tperftechs.asp

Hope this helps
Jay

"Tony Vitonis" <no***@nowhere.com> wrote in message
news:_R********************@comcast.com... From what I can tell, VB.NET doesn't allow programmers to say
explicitly that they want a function to be inlined. Now, I'm a big fan
of factoring out duplicate code, but I don't want to do too much of it
in VB if there's going to be a noticeable performance hit. So:

1. Does the VB compiler sometimes inline simple functions?
2. Is there much of a performance hit on a function call?

Thanks.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.