Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ static unsigned long long stringToULL(const std::string &s)

static bool endsWith(const std::string &s, const std::string &e)
{
return (s.size() >= e.size()) && std::equal(e.rbegin(), e.rend(), s.rbegin());
// TODO: std::equal() is much faster than std::string::compare() in a benchmark
// but in our case it leads to a big performance regression
//return (s.size() >= e.size()) && std::equal(e.rbegin(), e.rend(), s.rbegin());
return (s.size() >= e.size() && s.compare(s.size() - e.size(), e.size(), e) == 0);
}

static bool sameline(const simplecpp::Token *tok1, const simplecpp::Token *tok2)
Expand Down