Den 27-09-2017 kl. 23:06 skrev Ion Gaztañaga via Boost:
On 26/09/2017 22:03, Joaquin M López Muñoz via Boost wrote:
4. Same goes for the growing policy. Not even boost::container::vector features a growing policy, which seems an indication that this is not a heavily demanded customization point.
True. But is on my todo list I was recently trying to add customization options to Boost.Container containers (I need to offer something different to my fans that the standard containers can't offer ;-).
We do need some general agreement about what a boost library can do and not do. There is a large difference between saying "I'm not going to use this" or "I don't see the benefit" and saying "I want to prohibit legitimate use cases for other people".
Usually the choice is usually between a factor of 2 and 1.5. The theoretical limit value for the growth factor to be able to reuse previously allocated memory is roughly 1.61. Howard Hinnant shared with my a nice paper about this more than ten years ago showing how to grow using a factor of 1.6 and the math behind this. I just reviewed that brief paper recently, and since it's not longer online, Howard kindly has given me permission to share it with the Boost community.
Thanks for sharing this. There is another argument for 1.5 and that is that the casual users ends up with only about 16% wasted space on average compared to 25%. Reading through the argument, there are a few things I don't get. Is seems that the proof sort of assumes one container instance. And will the heap manager actually coalesce anything? kind regards -Thorsten