From 3ffe8707ab66051cbc14bd330fd2e14ac26b73c4 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 28 Jan 2013 09:43:54 +0100 Subject: [PATCH] Fix string_iless performance issue. --- lib/base/qstring.h | 8 ++++++++ lib/base/win32.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/lib/base/qstring.h b/lib/base/qstring.h index 298b9e1fc..d6cbecf4f 100644 --- a/lib/base/qstring.h +++ b/lib/base/qstring.h @@ -124,8 +124,16 @@ struct string_iless : std::binary_function { bool operator()(const String& s1, const String& s2) const { + return strcasecmp(s1.CStr(), s2.CStr()) < 0; + + /* The "right" way would be to do this - however the + * overhead is _massive_ due to the repeated non-inlined + * function calls: + return lexicographical_compare(s1.Begin(), s1.End(), s2.Begin(), s2.End(), boost::algorithm::is_iless()); + + */ } }; diff --git a/lib/base/win32.h b/lib/base/win32.h index a6fc28d9c..32a73507e 100644 --- a/lib/base/win32.h +++ b/lib/base/win32.h @@ -42,4 +42,6 @@ typedef DWORD pid_t; #define I2_EXPORT __declspec(dllexport) #define I2_IMPORT __declspec(dllimport) +#define strcasecmp stricmp + #endif /* WIN32_H */