After closer thought...
The vtable is created at compiletime and is shared between every instance of
a class.
Hence the only performance difference between 10 or 10000 virtual methods is
only the below mentioned
cache miss.

/ Erik

-----Original Message-----
From: Erik Rydgren [mailto:[EMAIL PROTECTED]]
Sent: den 13 december 2002 17:12
To: [EMAIL PROTECTED]
Subject: RE: FW: Const-correctness in Xerces and TreeWalker


Yepp it is a tedius work. But I disagree that you will have to duplicate ALL
functions.
Either the method does not change the object: getAttribute, getTagname.
(implies const methods)
or it does change the object: insert, delete, setAttribute and so on
(non-const method)
However functions that returns objects need to have both a non-const as well
as an const variant.
The performance hit comes from larger vtables that needs to be set at object
creation. After that...
Well jumping 40 bytes into the vtable is not slower then jumping 20 bytes
into it ( unless you get a cache miss that is :) )

/ Erik

-----Original Message-----
From: Tinny Ng [mailto:[EMAIL PROTECTED]]
Sent: den 13 december 2002 16:34
To: [EMAIL PROTECTED]
Subject: Re: FW: Const-correctness in Xerces and TreeWalker


I think we need to think again about this, as it's not only
"createTreeWalker", the DOM document has all those createXXXX methods like
"createElement", "createAtttribute" ..., and then all those inherited
DOMNode interface like "removeChild", "replaceChild" ...etc.   If we have to
overload each and every method with const modifier, it's not only a tedious
work but also PERFORMANCE may impact badly with all these overloaded virtual
functions.   From my point of view, it just doesn't worth at all.
Performance is much more important.  I would prefer leave it as is.

Tinny

----- Original Message -----
From: "Ingolf Steinbach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 13, 2002 10:00 AM
Subject: Re: FW: Const-correctness in Xerces and TreeWalker


> * Jennifer Schachter <[EMAIL PROTECTED]> [2002-12-13 15:55]:
> > This wouldn't help our problem: You cannot overload based on return
> > type...
> [...]
> > On Fri, 13 Dec 2002, Erik Rydgren wrote:
> [...]
> > > DOMDocument* DOMNode::getOwnerDocument();
> > > const DOMDocument* DOMNode::getOwnerDocument() const;
> [...]
> > > DOMTreeWalker* DOMDocument::createTreeWalker(DOMNode* node, and so
on...);
> > > const DOMTreeWalker* DOMDocument::createTreeWalker(const DOMNode*
node, and
> > > so on...) const;
>
> Note the "const" at the end of the lines. That's not overloading
> on return type (additionally, the second createTreeWalker() takes
> a "const DOMNode*"). So definitively the functions have a different
> signature which makes overloading possible.
>
> Regards
>     Ingolf
> --
>
> Ingolf Steinbach                       Jena-Optronik GmbH
> [EMAIL PROTECTED]       ++49 3641 200-147
> PGP: 0x7B3B5661  213C 828E 0C92 16B5  05D0 4D5B A324 EC04
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to