Skip to content

Commit

Permalink
Speed up GUID equality comparison.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Mar 6, 2018
1 parent d95eb0f commit 36d7296
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 1 addition & 3 deletions libgnucash/engine/guid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,7 @@ GUID::operator < (GUID const & other) noexcept

bool operator == (GUID const & lhs, GncGUID const & rhs) noexcept
{
auto ret = std::mismatch (lhs.begin (), lhs.end (), rhs.reserved);
return ret.first == lhs.end ();

return lhs.implementation == GUID(rhs).implementation;
}

bool
Expand Down
1 change: 1 addition & 0 deletions libgnucash/engine/guid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct GUID
auto begin () const noexcept -> decltype (implementation.begin ());
auto end () const noexcept -> decltype (implementation.end ());
bool operator < (GUID const &) noexcept;
friend bool operator == (GUID const &, GncGUID const &) noexcept;
friend bool operator != (GUID const &, GUID const &) noexcept;
};

Expand Down

0 comments on commit 36d7296

Please sign in to comment.