467,893 Members | 1,894 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,893 developers. It's quick & easy.

method inline optimization

anyone know the criteria a method must meet in order for it to be inlined?
and is there a way to force a method to be inlined? it's not one of the
MethodImplOptions.
Nov 17 '05 #1
  • viewed: 4381
Share:
5 Replies
Daniel,

You can not force a method to be inlined by the JIT. You can only force
it to NOT be inlined, either through the function being declared as virtual,
or using the MethodImpl attribute set so that it is not inlined.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel Jin" <Da*******@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
anyone know the criteria a method must meet in order for it to be inlined?
and is there a way to force a method to be inlined? it's not one of the
MethodImplOptions.

Nov 17 '05 #2
exactly what I figured. it's unfortunate that you can't force a method
to be inlined. back to my other question, anyone have any information
on what criteria a method must meet for it to even be considered for
inlining? I googled on that, and so far only found some information on
how the compact framework handles it.
Nicholas Paldino [.NET/C# MVP] wrote:
Daniel,

You can not force a method to be inlined by the JIT. You can only force
it to NOT be inlined, either through the function being declared as virtual,
or using the MethodImpl attribute set so that it is not inlined.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel Jin" <Da*******@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
anyone know the criteria a method must meet in order for it to be inlined?
and is there a way to force a method to be inlined? it's not one of the
MethodImplOptions.


Nov 17 '05 #3
Daniel Jin <sh********@yahoo.com> wrote:
exactly what I figured. it's unfortunate that you can't force a method
to be inlined. back to my other question, anyone have any information
on what criteria a method must meet for it to even be considered for
inlining? I googled on that, and so far only found some information on
how the compact framework handles it.


http://blogs.msdn.com/davidnotario/a...01/250398.aspx has a
fair amount on it, in terms of size etc.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4

"Daniel Jin" <Da*******@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
anyone know the criteria a method must meet in order for it to be inlined?
and is there a way to force a method to be inlined? it's not one of the
MethodImplOptions.


Not sure if this is still valid for v2.0 of the JIT, but AFAIK for v1.x the
following are not inlined:
- Methods wth > 32 bytes of IL.
- Virtual calls.
- Valuetypes, and MarshalByRef call targets.
- Complex flowgraphs like loops, methods with exception handling blocks.
- Security checks that need a method frame (compressed stack etc).
-????

Willy.


Nov 17 '05 #5
Thanks Jon for the link. MVP to the rescue.

"Jon Skeet [C# MVP]" wrote:
Daniel Jin <sh********@yahoo.com> wrote:
exactly what I figured. it's unfortunate that you can't force a method
to be inlined. back to my other question, anyone have any information
on what criteria a method must meet for it to even be considered for
inlining? I googled on that, and so far only found some information on
how the compact framework handles it.


http://blogs.msdn.com/davidnotario/a...01/250398.aspx has a
fair amount on it, in terms of size etc.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Balbir Singh | last post: by
7 posts views Thread by Aloo | last post: by
5 posts views Thread by Bert Jansen | last post: by
7 posts views Thread by Wu Shaohua | last post: by
9 posts views Thread by chinu | last post: by
15 posts views Thread by niklaus | last post: by
25 posts views Thread by toton | last post: by
14 posts views Thread by jg | last post: by
3 posts views Thread by az.anonymous | last post: by
32 posts views Thread by Immortal Nephi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.