cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 5 Nov 2015 17:11:50 +0100 (CET)

On Thu, 5 Nov 2015, WebMC wrote:

> You know, I prefer to deal with something similar, build a table at start:
> char maj[] = { 'A', 'B', ... 'Z' };
> then in the function, return maj[(unsigned char) (in-'a')]
>
> I'm not sure that this is better than the new Curl_raw_toupper code but try
> with a 256-elements table : it now avoids the "if (in >= 'a' && in <= 'z')"
> test, and the addition/subtraction too !

I did some basic tests with that too and compared with what we have now, but
the difference was not very big so I left the current approach.

If we want to increase speed further we can actually convert the function into
a macro for the ascii case, or otherwise make sure that it gets used inlined.
But I think the biggest speed increase has already been made. But if someone
can provide numbers on further notable speed gains I'm all ears!

If there are a lot of cookies, there will be much bigger speed gains to be had
by improving other areas.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2015-11-05