From 90b51c5f7901ebd4e1effad64b226a7004902866 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 25 Jun 2017 11:57:36 -0700 Subject: [PATCH] Small speed up in fields comparisons --- CHANGELOG.md | 1 + include/beast/http/fields.hpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 174bc62b..7571fd33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Version 68: * Split common tests to a new project +* Small speed up in fields comparisons API Changes: diff --git a/include/beast/http/fields.hpp b/include/beast/http/fields.hpp index 1d5d87be..b2167085 100644 --- a/include/beast/http/fields.hpp +++ b/include/beast/http/fields.hpp @@ -104,6 +104,10 @@ public: bool operator()(String const& lhs, value_type const& rhs) const { + if(lhs.size() < rhs.name_string().size()) + return true; + if(lhs.size() > rhs.name_string().size()) + return false; return iless::operator()(lhs, rhs.name_string()); } @@ -112,6 +116,10 @@ public: bool operator()(value_type const& lhs, String const& rhs) const { + if(lhs.name_string().size() < rhs.size()) + return true; + if(lhs.name_string().size() > rhs.size()) + return false; return iless::operator()(lhs.name_string(), rhs); } @@ -119,6 +127,10 @@ public: bool operator()(value_type const& lhs, value_type const& rhs) const { + if(lhs.name_string().size() < rhs.name_string().size()) + return true; + if(lhs.name_string().size() > rhs.name_string().size()) + return false; return iless::operator()(lhs.name_string(), rhs.name_string()); } };