]> granicus.if.org Git - icinga2/commitdiff
Fix string_iless performance issue.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 28 Jan 2013 08:43:54 +0000 (09:43 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 28 Jan 2013 08:43:54 +0000 (09:43 +0100)
lib/base/qstring.h
lib/base/win32.h

index 298b9e1fc6ed1e3204dee4202dcc7d13b005b436..d6cbecf4f7ad532e03d66e19774f3b25f31e2d32 100644 (file)
@@ -124,8 +124,16 @@ struct string_iless : std::binary_function<String, String, bool>
 {
        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());
+
+                */
        }
 };
 
index a6fc28d9cfe8824c5288fb24836c5ed5f0e07f0f..32a73507e68bab7bf39312266c1c1c53e214ee8e 100644 (file)
@@ -42,4 +42,6 @@ typedef DWORD pid_t;
 #define I2_EXPORT __declspec(dllexport)
 #define I2_IMPORT __declspec(dllimport)
 
+#define strcasecmp stricmp
+
 #endif /* WIN32_H */