Slow performance compared to C++, ideas?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jun 6 15:12:58 PDT 2013
On Thursday, June 06, 2013 14:57:00 Walter Bright wrote:
> On 6/6/2013 2:23 PM, Andrei Alexandrescu wrote:
> > (The tool I'm envisioning
> > would add final annotations or prompt the user to add them.)
>
> Sorry, that's never going to fly.
It could tell the programmer which functions it _thinks_ don't need to be
virtual, but it can't be 100% correct. So, it would effectively be a lint-like
tool targeting possible devirtualization opportunities. It would actually be
potentially useful regardless of whether virtual or non-virtual is the
default, since programmers may have needlessly marked functions as virtual.
But if it's a question of whether it's a good solution for optimizing away
virtuality instead of making functions non-virtual, then I don't think that it
would fly - not if optimization is a prime concern. It would just be a nice
helper tool for static analysis which could give you suggestions on things you
might be able to improve in your program.
But as it sounds like the primary argument which has swayed you towards making
non-virtual the default is tied to cleaner code evolution and maintenance
rather than performance, the suggestion obviously wouldn't be a viable
counterargument for going with virtual-by-default.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list