Skip to content

[libc++] Low-hanging fruit optimizations in std::is_permutation #129324

Open
@ldionne

Description

@ldionne

There's a place in std::is_permutation where we eliminate a common prefix at the start. We could use std::mismatch instead of a hand-written loop, since mismatch is vectorized.

Inside __is_permutation_impl, we can use std::find for "Have we already counted the number of *__i in [f1, l1)?"

In the main loop of __is_permutation_impl, we can basically use std::count to count the number of times a value appears, I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions