This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] Two versions of struct _Rb_tree_impl... or not?!
- From: "Dhruv Matani" <dhruvbird at gmx dot net>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: pcarlini at suse dot de, rittle at latour dot rsch dot comm dot mot dot com, libstdc++ at gcc dot gnu dot org
- Date: Wed, 7 Jul 2004 07:13:35 +0200 (MEST)
- Subject: Re: [RFC] Two versions of struct _Rb_tree_impl... or not?!
- References: <40EAD3ED.4040205@suse.de>
> Paolo Carlini wrote:
>
> > So, even with Dhruv patch, we would still regress *a lot* wrt
> > what we had in 3.3.3.
> >
> > What we have gained in the meanwhile so important to justify
> > this horrible (yes, seems horrible to me, frankly) size
> > regression??? Can we fix it???
>
> Ok, sorry, now I see what's really at stake: here we are obviously
> measuring
> only the size of the root, *not* the size of the nodes, which is given
> by the
> size of _Rb_tree_node, which has not changed for ages, I think.
>
> Therefore, if I'm right, we are talking about a lot of additional
> complexity
> to spare a few bytes on the memory used by an *entire* map or set object.
> Do we really want those two specializations of Rb_tree_impl??
>
What I think has happened is that the v3.3 and before has only a pointer to
the actual root node, and newer versions have the actual node as part of the
implementation structure. Hence, the difference in the size. Actually, the
current method of having the actual node is better, because there is one
poiner indirection less for every rb_tree operation.
Anyways, the patch is ready, and there will not be much effort required from
here on, so I guess the complexity issue should not come in. Consider that
you have an array of say 100 maps, then the memory saved would be something
like 400 bytes for x86 systems, which is quite a lot. We can save something
like 400/32 cache lines with this simple optimization.
-Dhruv.
--
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info