cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Lauri Kasanen <cand_at_gmx.com>
Date: Tue, 3 Nov 2015 12:11:28 +0200

> Thanks for alerting us about this!
>
> I found this case so intersting I ran my own test. I ran the function
> over 500MB of data from /dev/urandom and on this test data I could see
> a slightly better than 40% performance gain (with gcc -O3 on my 3.5GHz
> Intel i7 CPU).
>
> Still: "This was causing a two-second startup delay"
> seems unlikely. I could run the unoptimized version through 500MB of
> data in 1.5 seconds, and surely any sensible cookie use cases would be
> several magnitudes away of that?

Hi,

I have less than 1mb of cookies, 9203 according to wc -l. The timing
wasn't scientifically exact, but my senses aren't that far off to
mistake 0.something to 2 ;)

When I ran oprofile on just the app startup, curl was using 90% of cpu,
most of it in Curl_add_cookie and Curl_raw_equal. After this change,
Curl_raw_equal dropped from 55% to 29%. (function names from memory)

I could also separate the delay to curl by starting to an empty tab
instead of a web page: the delay would appear as soon as I wrote an
address and pressed enter, ie at the first invocation of curl code.

Now with this change, the startup delay has approximately halved, to
about one sec. I'm running on a Phenom 2. I didn't delve deep into the
cookie code, but it seems every cookie's every field is matched against
every other's on a quick look. 10k ^ 2 = 100M checks, times the number
of fields.

- Lauri

PS:
Sorry about breaking threading, I have delivery disabled to avoid yet
another ML. Please CC me.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-11-03