Skip to content

Is there interest for improving the efficiency of the any_cast for the case when the -fno-rtti flag is set #33

@freak82

Description

@freak82

Hi there,

As far as I looked at the code of boost::any currently it uses boost::typeindex for the cast functionality.
When the RTT information is turned off via -fno-rtti this causes the cast to do strcmp internally (link to godbolt) and leads to less efficient code than the libstdc++ implementation which does only function pointer comparison in this case (link to the implementation).
And boost::any already uses similar technique with function pointer for its internal operations.
So, my questions are:

  1. Is there some downside, that you can think of, in the libstdc++ approach versus the boost::any/typeindex approach? Can the comparison of the function pointer lead to wrong casts in some edge cases?
  2. Assuming that the libstdc++ approach has no downsides, is there an interest for changing the implementation of boost::any?

Regards,
Pavel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR welcomedNeeds a champion to implement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions