Re: Speed of interfaces vs inheritance




"Chris" <spam_me_not@xxxxxxxxxx> wrote in message
news:4596b7a9$0$1612$9a6e19ea@xxxxxxxxxxxxxxxxxxxxxxx
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?

(In this particular situation, either approach works fine, though I
personally like the interface approach better).

The only way to answer this question is to write a test.


.



Relevant Pages

  • Re: On Interfaces (was Re: initializing a vector)
    ... > methods in a super-class and have all the classes extend it or should I ... > declare an interface and have all those classes implement it? ... bother to implement in each leaf class. ... Then have the leaf classes extend the superclass if appropriate (eg they ...
    (comp.lang.java.programmer)
  • Speed of interfaces vs inheritance
    ... In a particularly time-critical part of my app I need to call a method on an external class in a tight loop. ... create an interface and have the various different classes implement it, or create an abstract class and have the various different classes extend it. ...
    (comp.lang.java.programmer)
  • Re: Speed of interfaces vs inheritance
    ... create an interface and have the various different classes implement it, or create an abstract class and have the various different classes extend it. ... to be my default Java (SUN Java 1.5 Win32) interface is ... actually faster than abstract base class. ...
    (comp.lang.java.programmer)
  • Re: Speed of interfaces vs inheritance
    ... on an external class in a tight loop. ... different contexts. ... and have the various different classes extend it. ... I seem to recall, in years past, that the interface approach was slower. ...
    (comp.lang.java.programmer)
  • Re: [KVM PATCH v2 2/2] kvm: add support for irqfd via eventfd-notification interface
    ... So what is your proposal for such interface? ... Alternatively, a new fileop ->signal_event, which would map to ... irq contexts. ... and make eventfd and irqfd the first implementations. ...
    (Linux-Kernel)