Boost logo

Boost :

Subject: Re: [boost] [histogram] review part 2 (implementation)
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2018-09-26 16:43:26


> On 26. Sep 2018, at 17:02, Steven Watanabe via Boost <boost_at_[hidden]> wrote:
>
> On 09/25/2018 03:44 PM, Hans Dembinski wrote:
>>
>> The histogram iterators over axis types a lot. If they are small they are more likely to fit onto a cache line. When you use a dynamic histogram, the size of axis::any<…> is size of largest bounded axis type plus some bytes for the type index. The largest bounded axis type determines the size of axis::any, so I was generally careful in making the larger axis types not larger than necessary.
>>
>
> This actually makes the optimization pointless.
> regular<pow> -> 3 doubles
> variable (with buffer) -> 1 pointer
> variable (with vector) -> 3 pointers

Fair enough, but the picture changes when the allocator has a non-zero size.

Apart from that, aren't you bothered by the fact that a axis::variable (with vector) derived from axis::base stores the size twice, once as an int inside axis::base and again inside the vector, plus the superfluous field of capacity, and an extra instance of the allocator, while the current implementation stores the allocator only once, and does not waste any memory? I thought people here would tear me apart if I present a design that is so wasteful.

Twice storing the size could be avoided by lifting the requirement that all axis types have to derive from axis::base, which I am considering. But with a standard vector you cannot avoid the superfluous capacity field and the duplicated allocator.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk