Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Performance] Replace Bimap with something more efficient #13

Open
chrisg89 opened this issue Dec 11, 2022 · 0 comments
Open

[Performance] Replace Bimap with something more efficient #13

chrisg89 opened this issue Dec 11, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@chrisg89
Copy link
Owner

A Bimap (similar to Boost.Bimap) is used in the construction of the DFA. This custom data type is very expensive (time & space). An alternative implementation will more than likely improve the performance of the library.

Specifically, the custom hasher used by the Bimap to hash a std::set is extremely wasteful:

// todo: This hasher is too expensive (especially on non-sequential containers
// such as sets). Need to find another way to create a bi-map or replace the
// bi-map entirely
struct SetHasher
{
    std::size_t operator()(const std::set<StateId>& V) const
    {
        auto hash = V.size();
        for (const auto i : V)
        {
            hash ^= i + 0x9e3779b9 + (hash << 6) + (hash >> 2);
        }
        return hash;
    }
};
@chrisg89 chrisg89 added the enhancement New feature or request label Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant