Re: Any Checkstyle users?
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 11:56:11 GMT
On Tue, 31 Jan 2006 15:14:29 +1000, "Tony Morris" <not@xxxxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
> I'm sure (at least, I hope) you'll agree. In
>fact, it has nothing at all to do with interfaces, and everything to do with
>the level of depth in "virtuality" of the lookup, which class types can also
>"suffer" from.
Not at all. Calls to methods via interfaces are much trickier than
calls to virtual instance methods.. For classes, the method lives at
a fixed offset in a vtbl for the calls. Bjarne Stroustrup, the father
of C++, invented the vtbl. I am impressed all to heck since I tried
for years to invent it on my own for my own language, coming up with
nothing nearly as elegant. All you need is the method number and the
vtbl for the class this object ACTUALLY is and away you go , not that
much worse that a call to a static method.
But for a call to a method via an interface reference the method is at
a different offset in every implementing method. Various goofy
schemes are used from linearly scanning for it on every call, caching
the last hit or two, miniature HashMaps where you look up the
interface to get the offset of the method to implement each call...
I understand that much research has gone into efficiently implementing
calls to methods via interface references and the penalties are not
nearly so severe as in past.
People use interface references in preference to class references, to
the point making up dummy interfaces that have only one implementor
and always will. I think you should only use interface references
when there is a likely benefit.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- Any Checkstyle users?
- From: slippymississippi
- Re: Any Checkstyle users?
- From: mikm
- Re: Any Checkstyle users?
- From: mikm
- Re: Any Checkstyle users?
- From: Tony Morris
- Re: Any Checkstyle users?
- From: Roedy Green
- Re: Any Checkstyle users?
- From: Tony Morris
- Any Checkstyle users?
- Prev by Date: Re: signum of long
- Next by Date: Re: Any Checkstyle users?
- Previous by thread: Re: Any Checkstyle users?
- Next by thread: Re: Any Checkstyle users?
- Index(es):
Relevant Pages
|