www.digitalmars.com         C & C++   DMDScript  

c++ - empty base class optimization

reply "Laurentiu Pancescu" <user domain.invalid> writes:
In an article by Nathan Myers (http://www.cantrip.org/emptyopt.html),
amongst the compilers that support the empty base class optimization was
also Symantec.  However, DMC doesn't do that by default, and I didn't find
any mention to that in documentation.  Is it supported by DMC?

While looking in the old help files (after looking in the new HTML docs, of
course :), I saw a section about internal limits of DMC: no more than 254
chars in identifiers.  Does this apply to *my* identifiers, or to the
mangled names that DMC generates?  I encountered such issues related to
mangled names maximum length in MSVC6, I just couldn't debug a program that
had a map<string, map<string, string> >, because of that limit (it linked
and executed fine in release mode, though).  I hope it's not the case with
DMC, is it?

Laurentiu
Mar 26 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Laurentiu Pancescu" <user domain.invalid> wrote in message
news:a7qkp1$17gg$1 digitaldaemon.com...
 In an article by Nathan Myers (http://www.cantrip.org/emptyopt.html),
 amongst the compilers that support the empty base class optimization was
 also Symantec.  However, DMC doesn't do that by default, and I didn't find
 any mention to that in documentation.  Is it supported by DMC?
It isn't done in DMC in order to have the objects binary compatible with Microsoft C.
 While looking in the old help files (after looking in the new HTML docs,
of
 course :), I saw a section about internal limits of DMC: no more than 254
 chars in identifiers.  Does this apply to *my* identifiers, or to the
 mangled names that DMC generates?  I encountered such issues related to
 mangled names maximum length in MSVC6, I just couldn't debug a program
that
 had a map<string, map<string, string> >, because of that limit (it linked
 and executed fine in release mode, though).  I hope it's not the case with
 DMC, is it?
It's around 900 for DMC, and it's after mangling.
Mar 26 2002
next sibling parent reply Christof Meerwald <cmeerw web.de> writes:
On 27 Mar 2002, Walter wrote:
 "Laurentiu Pancescu" <user domain.invalid> wrote in message
 news:a7qkp1$17gg$1 digitaldaemon.com...
 In an article by Nathan Myers (http://www.cantrip.org/emptyopt.html),
 amongst the compilers that support the empty base class optimization
 was also Symantec.  However, DMC doesn't do that by default, and I
 didn't find any mention to that in documentation.  Is it supported by
 DMC? 
It isn't done in DMC in order to have the objects binary compatible with Microsoft C.
But at least version 6.0 of Microsoft Visual C++ does implement the empty base class optimization. bye, Christof
Mar 27 2002
parent "Walter" <walter digitalmars.com> writes:
"Christof Meerwald" <cmeerw web.de> wrote in message
news:a7s2fe$2131$1 digitaldaemon.com...
 But at least version 6.0 of Microsoft Visual C++ does implement the empty
 base class optimization.
Just checked, you're right, it does. I'll go ahead and implement it for 8.28.
Mar 28 2002
prev sibling parent reply "Laurentiu Pancescu" <user invalid.domain> writes:
"Walter" <walter digitalmars.com> wrote in message
news:a7r6g6$1i05$1 digitaldaemon.com...
 "Laurentiu Pancescu" <user domain.invalid> wrote in message
 news:a7qkp1$17gg$1 digitaldaemon.com...
 In an article by Nathan Myers (http://www.cantrip.org/emptyopt.html),
 amongst the compilers that support the empty base class optimization was
 also Symantec.  However, DMC doesn't do that by default, and I didn't
find
 any mention to that in documentation.  Is it supported by DMC?
It isn't done in DMC in order to have the objects binary compatible with Microsoft C.
MSVC6 does this optimization by default, I just checked yesterday - is MSVC6 what you mean by "Microsoft C"? BCC and gcc have this available, but not active by default. It could speed up STL operation (see the article in the original post, someone from Watcom said that it improved STL performance by 30% with their compiler), and reduce memory consumption of EXEs using STL. Would it be hard to do (or to put back, if Symantec C++ had it)? Eventually with a command line switch to activate it? Laurentiu
Mar 27 2002
parent "Walter" <walter digitalmars.com> writes:
"Laurentiu Pancescu" <user invalid.domain> wrote in message
news:a7s2p4$21gs$1 digitaldaemon.com...
 MSVC6 does this optimization by default, I just checked yesterday - is
MSVC6
 what you mean by "Microsoft C"?
It was an earlier version we tried to be compatible with. BCC and gcc have this available, but not
 active by default.  It could speed up STL operation (see the article in
the
 original post, someone from Watcom said that it improved STL performance
by
 30% with their compiler), and reduce memory consumption of EXEs using STL.
 Would it be hard to do (or to put back, if Symantec C++ had it)?
Eventually
 with a command line switch to activate it?
I find it amusing that this is called an "optimization", because that's what the compiler did originally. It required extra work to "deoptimize" it to be compatible with VC. It's likely it wouldn't be too much trouble to remove that kludge, but I worry about breaking compatibility with some existing library.
Mar 27 2002