Boost logo

Boost :

Subject: Re: [boost] Any interest in Compile Time Hash Containers library?
From: Ivan Matek (libbooze_at_[hidden])
Date: 2019-01-24 22:26:03


On Thu, Jan 24, 2019 at 9:49 AM John Maddock via Boost <
boost_at_[hidden]> wrote:

> Question: would the interface be better specified with a constexpr
> initializer-list constructor rather than templating on an array of
> data? That way you would have complete control of memory layout as
> well? Or am I misinterpreting things?
>
I think that if you want best performance you want to template on values
since if for example you only template on type, then you can not know some
very useful stuff at compile time. We want to pick a constant for universal
hashing that works great for our values. Consider example where we are
lucky and we get no collisions. If we know that at compile time compiler
can remove the loop(probe until some condition) since it knows iteration
count is 1.
If that value is just some member variable that can be 1 or 2 or 5
depending on data compiler can not remove that loop.
In other words I believe that for best performance codegen for different
values needs to be different.
I am happy to be proven wrong. :)


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