3 ms·
I mean, I'm not sure where this 'fear' even came from? At its core, inheritence is a special case of composition anyways (looked at from the other perspective
by stormbrew 5y ago
I mean, I'm not sure where this 'fear' even came from?
At its core, inheritence is a special case of composition anyways (looked at from the other perspective it's syntactic sugar over either static or dynamic delegation), so it can't really be "faster".
At any rate, there's no abstraction so powerful it can prevent a programmer from making it slow.
- lostmsu 5y agoThis is true for languages where most objects are not garbage-collected. In Java (modern days) this would add a level of indirection.
- kaba0 5y agoWhich may be in certain cases trivially optimizable. Eg. an object available only inside a class can have its method calls inlined into the containing class’s methods. (But I’m no JVM developer (unfortunately) so I’m not sure whether this exact optimization exists or not)