You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Gareth Reakes <ga...@decisionsoft.com> on 2002/09/09 14:57:42 UTC

magic number in DOMDocumentImpl

Hi all,
	Im creating a new node type. Im copying the release code from 
another node type. When following this through I noticed that in 
DOMDocumentImpl the recycle buffers are created like such

        fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);

now I assume that the size that is required is determined by 
NodeObjectType in DOMDocumentImpl. This only goes up to 12. Is there any 
reason why we declare them to be 15? Or can I just use number 13?


Gareth


-- 
Gareth Reakes, Head of Product Development  
DecisionSoft Ltd.            http://www.decisionsoft.com
Office: +44 (0) 1865 203192



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: magic number in DOMDocumentImpl

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hey Tinny,
	the only problem with that is it means people will have to adjust 
it if they want to add a new node type. 

Gareth


On Tue, 10 Sep 2002, Tinny Ng wrote:

> Gareth,
> 
> I think you are right, we should only need initial size of 13 ... I can fix
> that when I am back to office next week.
> 
> Tinny
> 
> ----- Original Message -----
> From: "Gareth Reakes" <ga...@decisionsoft.com>
> To: <xe...@xml.apache.org>
> Sent: Tuesday, September 10, 2002 6:20 AM
> Subject: Re: magic number in DOMDocumentImpl
> 
> 
> > Hey Tinny,
> >
> > Look at the following code. I agree that the second 15 is
> > arbitrary, but I believe the first one is not. We index into the array of
> > arrays with the NodeObjectType value. This value is defined as going up to
> > 12. Am I missing something?
> >
> >
> >     if (!fRecycleNodePtr)
> >         fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);
> >
> >     if (!fRecycleNodePtr->operator[](type))
> >         fRecycleNodePtr->operator[](type) = new RefStackOf<DOMNode> (15,
> > false);
> >
> >
> > Gareth
> >
> >
> >
> >
> > On Mon, 9 Sep 2002, Tinny Ng wrote:
> >
> > > Gareth,
> > >
> > > The number '15' is arbitrary.   This just assumes in most scenarios,
> there
> > > are 15 or less recycled node object.   If not enough, the RefArrayOf
> will
> > > grow automatically.   We just try to pick a number that most customers
> > > scenario may hit for best performance.   If you find this number is not
> > > optimal, feel free to let us know.
> > >
> > > Tinny
> > >
> > > ----- Original Message -----
> > > From: "Gareth Reakes" <ga...@decisionsoft.com>
> > > To: <xe...@xml.apache.org>
> > > Sent: Monday, September 09, 2002 8:57 AM
> > > Subject: magic number in DOMDocumentImpl
> > >
> > >
> > > > Hi all,
> > > > Im creating a new node type. Im copying the release code from
> > > > another node type. When following this through I noticed that in
> > > > DOMDocumentImpl the recycle buffers are created like such
> > > >
> > > >         fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);
> > > >
> > > > now I assume that the size that is required is determined by
> > > > NodeObjectType in DOMDocumentImpl. This only goes up to 12. Is there
> any
> > > > reason why we declare them to be 15? Or can I just use number 13?
> > > >
> > > >
> > > > Gareth
> > > >
> > > >
> > > > --
> > > > Gareth Reakes, Head of Product Development
> > > > DecisionSoft Ltd.            http://www.decisionsoft.com
> > > > Office: +44 (0) 1865 203192
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > >
> >
> > --
> > Gareth Reakes, Head of Product Development
> > DecisionSoft Ltd.            http://www.decisionsoft.com
> > Office: +44 (0) 1865 203192
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 

-- 
Gareth Reakes, Head of Product Development  
DecisionSoft Ltd.            http://www.decisionsoft.com
Office: +44 (0) 1865 203192



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: magic number in DOMDocumentImpl

Posted by Tinny Ng <tn...@ca.ibm.com>.
Gareth,

I think you are right, we should only need initial size of 13 ... I can fix
that when I am back to office next week.

Tinny

----- Original Message -----
From: "Gareth Reakes" <ga...@decisionsoft.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, September 10, 2002 6:20 AM
Subject: Re: magic number in DOMDocumentImpl


> Hey Tinny,
>
> Look at the following code. I agree that the second 15 is
> arbitrary, but I believe the first one is not. We index into the array of
> arrays with the NodeObjectType value. This value is defined as going up to
> 12. Am I missing something?
>
>
>     if (!fRecycleNodePtr)
>         fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);
>
>     if (!fRecycleNodePtr->operator[](type))
>         fRecycleNodePtr->operator[](type) = new RefStackOf<DOMNode> (15,
> false);
>
>
> Gareth
>
>
>
>
> On Mon, 9 Sep 2002, Tinny Ng wrote:
>
> > Gareth,
> >
> > The number '15' is arbitrary.   This just assumes in most scenarios,
there
> > are 15 or less recycled node object.   If not enough, the RefArrayOf
will
> > grow automatically.   We just try to pick a number that most customers
> > scenario may hit for best performance.   If you find this number is not
> > optimal, feel free to let us know.
> >
> > Tinny
> >
> > ----- Original Message -----
> > From: "Gareth Reakes" <ga...@decisionsoft.com>
> > To: <xe...@xml.apache.org>
> > Sent: Monday, September 09, 2002 8:57 AM
> > Subject: magic number in DOMDocumentImpl
> >
> >
> > > Hi all,
> > > Im creating a new node type. Im copying the release code from
> > > another node type. When following this through I noticed that in
> > > DOMDocumentImpl the recycle buffers are created like such
> > >
> > >         fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);
> > >
> > > now I assume that the size that is required is determined by
> > > NodeObjectType in DOMDocumentImpl. This only goes up to 12. Is there
any
> > > reason why we declare them to be 15? Or can I just use number 13?
> > >
> > >
> > > Gareth
> > >
> > >
> > > --
> > > Gareth Reakes, Head of Product Development
> > > DecisionSoft Ltd.            http://www.decisionsoft.com
> > > Office: +44 (0) 1865 203192
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
>
> --
> Gareth Reakes, Head of Product Development
> DecisionSoft Ltd.            http://www.decisionsoft.com
> Office: +44 (0) 1865 203192
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: magic number in DOMDocumentImpl

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hey Tinny,

	Look at the following code. I agree that the second 15 is 
arbitrary, but I believe the first one is not. We index into the array of 
arrays with the NodeObjectType value. This value is defined as going up to 
12. Am I missing something?
	

    if (!fRecycleNodePtr)
        fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);

    if (!fRecycleNodePtr->operator[](type))
        fRecycleNodePtr->operator[](type) = new RefStackOf<DOMNode> (15, 
false);


Gareth




On Mon, 9 Sep 2002, Tinny Ng wrote:

> Gareth,
> 
> The number '15' is arbitrary.   This just assumes in most scenarios, there
> are 15 or less recycled node object.   If not enough, the RefArrayOf will
> grow automatically.   We just try to pick a number that most customers
> scenario may hit for best performance.   If you find this number is not
> optimal, feel free to let us know.
> 
> Tinny
> 
> ----- Original Message -----
> From: "Gareth Reakes" <ga...@decisionsoft.com>
> To: <xe...@xml.apache.org>
> Sent: Monday, September 09, 2002 8:57 AM
> Subject: magic number in DOMDocumentImpl
> 
> 
> > Hi all,
> > Im creating a new node type. Im copying the release code from
> > another node type. When following this through I noticed that in
> > DOMDocumentImpl the recycle buffers are created like such
> >
> >         fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);
> >
> > now I assume that the size that is required is determined by
> > NodeObjectType in DOMDocumentImpl. This only goes up to 12. Is there any
> > reason why we declare them to be 15? Or can I just use number 13?
> >
> >
> > Gareth
> >
> >
> > --
> > Gareth Reakes, Head of Product Development
> > DecisionSoft Ltd.            http://www.decisionsoft.com
> > Office: +44 (0) 1865 203192
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 

-- 
Gareth Reakes, Head of Product Development  
DecisionSoft Ltd.            http://www.decisionsoft.com
Office: +44 (0) 1865 203192



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: magic number in DOMDocumentImpl

Posted by Tinny Ng <tn...@ca.ibm.com>.
Gareth,

The number '15' is arbitrary.   This just assumes in most scenarios, there
are 15 or less recycled node object.   If not enough, the RefArrayOf will
grow automatically.   We just try to pick a number that most customers
scenario may hit for best performance.   If you find this number is not
optimal, feel free to let us know.

Tinny

----- Original Message -----
From: "Gareth Reakes" <ga...@decisionsoft.com>
To: <xe...@xml.apache.org>
Sent: Monday, September 09, 2002 8:57 AM
Subject: magic number in DOMDocumentImpl


> Hi all,
> Im creating a new node type. Im copying the release code from
> another node type. When following this through I noticed that in
> DOMDocumentImpl the recycle buffers are created like such
>
>         fRecycleNodePtr = new RefArrayOf<DOMNodePtr> (15);
>
> now I assume that the size that is required is determined by
> NodeObjectType in DOMDocumentImpl. This only goes up to 12. Is there any
> reason why we declare them to be 15? Or can I just use number 13?
>
>
> Gareth
>
>
> --
> Gareth Reakes, Head of Product Development
> DecisionSoft Ltd.            http://www.decisionsoft.com
> Office: +44 (0) 1865 203192
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org