Boost logo

Boost :

From: Jean-Louis Leroy (jl_at_[hidden])
Date: 2025-05-02 00:09:37


> 1. fast_perfect_hash achieves performance(load factor) I would assume is
> impossible, based on perfect hashing talk
> <https://www.youtube.com/watch?v=yOo6GnbKzp8>. I presume reason why it works
> so well that compiler places type info data clustered in same region of
> addresses... Is that correct?

I don't think it is a factor. And counting on clustering would be a rabbit hole
all the way to compiler-specific behavior hell.

Joaquín and I discussed this in Madrid - we were both speakers at the "using
std::cpp" conference. I think it boils down to:

- I make many more attempts with the same number of buckets.
- My hash function is very simple.
- For my purpose, speed matters, not space.

Maybe Joaquín wants to jump in, I don't want to put words in his mouth ;-)

> 2. regarding static_list: would Boost.Intrusive list work here also, and if so
> was this considered?

Yes. static_list needs to work in a special context: static construction
time.I.e., no guaranteed construction order across translation units. Its
default constructor does nothing. It relies on zero-initialization.

I remember that Boost.Intrusive lists had customization points, but not what I
needed. Unless I missed something...

> 3. basic_error_output does not seem to need the Policy template parameter, is
> this left for consistency or am I wrong that it is not needed?

It is needed because it has static state:

    template<class Policy, typename Stream = detail::ostderr>
    struct basic_error_output : virtual error_output {
        static Stream error_stream;
    };

My policy's error_stream is not your policy's error_stream ;-)

> 4. dynamic_cast_ref docs
> <https://github.com/jll63/Boost.OpenMethod/blob/ea7dbe86b511797f0281ef07b3ada645fe569328/doc/custom_rtti.adoc>
> mention that D must match the reference category of B. Would it be possible to
> static_assert that?

Probably this is a better place, in core.hpp:

    template<class Policy, class D, class B>
    auto optimal_cast(B&& obj) -> decltype(auto) {
        if constexpr (requires_dynamic_cast<B, D>) {
            return Policy::template dynamic_cast_ref<D>(std::forward<B>(obj));
        } else {
            return static_cast<D>(obj);
        }
    }

Enforce the contract at the source. Good suggestion though...

On Thu, May 1, 2025 at 6:33 PM Ivan Matek via Boost
<boost_at_[hidden]> wrote:
>
> Hi everyone,
> few questions:
>
>
> 1. fast_perfect_hash achieves performance(load factor) I would assume is
> impossible, based on perfect hashing talk
> <https://www.youtube.com/watch?v=yOo6GnbKzp8>. I presume reason why it
> works so well that compiler places type info data clustered in same region
> of addresses... Is that correct?
> 2. regarding static_list: would Boost.Intrusive list work here also, and
> if so was this considered?
> 3. basic_error_output does not seem to need the Policy template
> parameter, is this left for consistency or am I wrong that it is not needed?
> 4. dynamic_cast_ref docs
> <https://github.com/jll63/Boost.OpenMethod/blob/ea7dbe86b511797f0281ef07b3ada645fe569328/doc/custom_rtti.adoc>
> mention that D must match the reference category of B. Would it be possible
> to static_assert that?
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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