This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Vector (string?) growth factor of 1.5 (insted of 2)


On Mon, 2004-02-02 at 20:52, Paolo Carlini wrote:
> Hi everyone,
> 
> I'm studying a recent discussion thread on comp.lang.c++.moderated
> (google for 'vector growth factor of 1.5' if you are interested)
> according to which this value, instead of the more common 2, should
> be preferred.
> 
> Naively, one could believe that which value is better (provided the
> exponential requirements are fulfilled) should be decided empirically,
> or even, that each application has its "best" value.
> 
> Interestingly, however, Andrew Koenig pointed out that there are
> *theoretical* reasons (related basically to memory fragmentation) to
> prefer 1.5 to 2.
> 
> Any opinions?
> 
> As far as performance is concerned, actually my first rough test seem
> to show a really *minor* negative impact, so, if memory usage is so
> much better..

Have you tried for vector<pod> and vector<with_non_trivial_copy_ctor>?
such as std::string? How much is the difference for bot approaches with
2 and 1.5 as the growth factor? Does the performance improve as the size
of the vector increases or does it deprove? What about memory
fragmentation using the specialized libstdc++-v3 allocators? Are there
any redundant copies made with using the specialized allocators?

Linux glibc calls mmap for large requests.

Do you think that this can be worked out with Gabriel Dos Reis in
conjunction with the plan for allowing reallocation of memory for
vectors?



-- 
	-Dhruv Matani.
http://www.geocities.com/dhruvbird/




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]