Some performance questions
grauzone
none at example.net
Mon Feb 2 13:55:54 PST 2009
I agree. Of course using an interface to call a method always requires a
virtual method call. It's even slower than a virtual method call,
because it needs to convert the interface reference into an object
reference.
But he still could call the method in question directly. Implementing an
interface can be useful to enforce a contract. You can't do that with
structs.
Code compiled in debug mode (or was it not-release mode) also calls the
code to check the invariant, even if you didn't define one. I guess this
can make calling struct methods much faster than object methods.
More information about the Digitalmars-d-learn
mailing list