cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH v3] rawstr: Speed up Curl_raw_toupper by 40%

From: Lauri Kasanen <cand_at_gmx.com>
Date: Mon, 2 Nov 2015 22:18:03 +0200

Rationale: when starting up a curl-using app, all cookies from the jar are
checked against each other. This was causing a two-second startup delay in
the Fifth browser.

All tests pass.

Signed-off-by: Lauri Kasanen <cand_at_gmx.com>

---
v3: Test with CURL_DOES_CONVERSIONS.
 lib/rawstr.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/lib/rawstr.c b/lib/rawstr.c
index e27dac4..0a538fa 100644
--- a/lib/rawstr.c
+++ b/lib/rawstr.c
@@ -28,6 +28,10 @@
    its behavior is altered by the current locale. */
 char Curl_raw_toupper(char in)
 {
+#if !defined(CURL_DOES_CONVERSIONS)
+  if (in >= 'a' && in <= 'z')
+    return 'A' + in - 'a';
+#else
   switch (in) {
   case 'a':
     return 'A';
@@ -82,6 +86,8 @@ char Curl_raw_toupper(char in)
   case 'z':
     return 'Z';
   }
+#endif
+
   return in;
 }
 
-- 
2.6.2
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2015-11-02