Re: Speed of interfaces vs inheritance
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Sat, 30 Dec 2006 14:45:58 -0500
Chris wrote:
In a particularly time-critical part of my app I need to call a method on an external class in a tight loop. The class can be different in different contexts. I've got two choices: create an interface and have the various different classes implement it, or create an abstract class and have the various different classes extend it.
I seem to recall, in years past, that the interface approach was slower. Is this still the case?
I guess that would be implementation specific.
I would expect them to be relative close in performance
due the similarity of what has to be done.
And if the method is actually doing some work the call overhead should
be minimal compared to what is happening inside the method.
A quick test with some randomly created code on what happen
to be my default Java (SUN Java 1.5 Win32) interface is
actually faster than abstract base class.
Arne
.
- References:
- Speed of interfaces vs inheritance
- From: Chris
- Speed of interfaces vs inheritance
- Prev by Date: Re: Comparing floating point values in Java
- Next by Date: Advantages and Disadvantages of the Spring Framework
- Previous by thread: Re: Speed of interfaces vs inheritance
- Next by thread: Re: Speed of interfaces vs inheritance
- Index(es):
Relevant Pages
|
|