Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: Fewer mallocs is better, episode #47
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Henrik Holst via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 4 Feb 2022 02:09:14 +0100
I've tried to dive a bit deeper on this subject and still not really sure
why google.com despite the redirect triggers so many strlen calls in curl,
fetching https://curl.se/ yields only 173 calls so almost 1/4 the amount
from the google case.
23% of those for curl.se and 8% for google.com is due to
Curl_compareheader, this looks like an internal only function and every
single use inside curl is using string literals so we can replace them all
with a compile time sizeof, if patches for this would be accepted then I
would be happy to provide such.
A static amount (80 calls) so 46% for curl.se and 13% for google.com is due
to Curl_setstropt which all seems to be from external strings so strlen is
unavoidable here.
Which leaves 53 strlen calls for curl.se and 490 for google.com, for curl.se
these are probably "no issue" but still no idea where the 490 ones for
google.com comes from (the traces only shows that strlen was called, not on
which string it was called so the digging is a bit time consuming).
/HH
Den fre 28 jan. 2022 kl 15:00 skrev Daniel Stenberg via curl-library <
curl-library_at_lists.haxx.se>:
> On Thu, 27 Jan 2022, Gavin Henry via curl-library wrote:
>
> > Yes, it was strlen. My apologies. They switch to berval types:
>
> For the fun of it I checked curl's use of strlen in a typical invoke like
> shown before. "curl -Ls https://google.com/" (which includes a redirect)
>
> Counting all uses with ltrace, also including OpenSSL etc.
>
> It then makes around 686 calls to strlen(). The *total* size was 7826,
> thus
> the average call is for strings less than 12 bytes long. The longest
> returned
> value is 36 (*) The median length is 10.
>
> Conclusion: I'm not seeing a general strlen problem in curl.
>
> (*) = this is the longest SAN name returned in the server cert
>
> --
>
> / daniel.haxx.se
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://curl.se/support.html
> --
> Unsubscribe: https://lists.haxx.se/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>
Date: Fri, 4 Feb 2022 02:09:14 +0100
I've tried to dive a bit deeper on this subject and still not really sure
why google.com despite the redirect triggers so many strlen calls in curl,
fetching https://curl.se/ yields only 173 calls so almost 1/4 the amount
from the google case.
23% of those for curl.se and 8% for google.com is due to
Curl_compareheader, this looks like an internal only function and every
single use inside curl is using string literals so we can replace them all
with a compile time sizeof, if patches for this would be accepted then I
would be happy to provide such.
A static amount (80 calls) so 46% for curl.se and 13% for google.com is due
to Curl_setstropt which all seems to be from external strings so strlen is
unavoidable here.
Which leaves 53 strlen calls for curl.se and 490 for google.com, for curl.se
these are probably "no issue" but still no idea where the 490 ones for
google.com comes from (the traces only shows that strlen was called, not on
which string it was called so the digging is a bit time consuming).
/HH
Den fre 28 jan. 2022 kl 15:00 skrev Daniel Stenberg via curl-library <
curl-library_at_lists.haxx.se>:
> On Thu, 27 Jan 2022, Gavin Henry via curl-library wrote:
>
> > Yes, it was strlen. My apologies. They switch to berval types:
>
> For the fun of it I checked curl's use of strlen in a typical invoke like
> shown before. "curl -Ls https://google.com/" (which includes a redirect)
>
> Counting all uses with ltrace, also including OpenSSL etc.
>
> It then makes around 686 calls to strlen(). The *total* size was 7826,
> thus
> the average call is for strings less than 12 bytes long. The longest
> returned
> value is 36 (*) The median length is 10.
>
> Conclusion: I'm not seeing a general strlen problem in curl.
>
> (*) = this is the longest SAN name returned in the server cert
>
> --
>
> / daniel.haxx.se
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://curl.se/support.html
> --
> Unsubscribe: https://lists.haxx.se/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>
-- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2022-02-04