What is an inline method and when do we do that Regards, aakash
Peter Kristensson
Ranch Hand
Joined: Jul 02, 2001
Posts: 118
posted
0
Hiya! What is an inline method and when do we do that? If I'm not completelty mistaken, inlining is a thing that's happening during compile-time. The compiler inserts the code for a method where the method itself is called. I think that this only happens when the called method is in the same class as the caller-method. I'll try to make an example. Consider this class:
Now this would be transformed to something like this during compile-time:
Not sure that it will be exactly this way, but the basiscs are ther I think. Hope this helps. /Peter
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
posted
0
Peter's explantion on inline method is correct. But however, a method MAY be made inline if it is declared final. I don't thing all the final methods will be made inline. It is upto the compiler to decide to make a final method inline or not. Inline methods reduces the overheads on method calls.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.