curl / Mailing Lists / curl-library / Single Mail
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

From: Henrik Holst via curl-library <curl-library_at_lists.haxx.se>
Date: Sat, 5 Feb 2022 00:38:00 +0100

Den fre 4 feb. 2022 kl 08:00 skrev Daniel Stenberg <daniel_at_haxx.se>:

> On Fri, 4 Feb 2022, Henrik Holst wrote:
>
> > 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).
>
> I suspect the reason for this difference might be the SAN name checks for
> the
> server certificate, since those name checks (when built to use OpenSSL)
> are
> done by curl code and the google.com servers have a rather large amount
> of
> names to check. See lib/hostcheck.c:Curl_cert_hostcheck()
>
Looks like for google.com half of them comes from the cert check,
hostmatch() is called 220 times for google.com and only 2 times for curl.se.

Half of those strlen calls (111 for google.com) can be easily removed and
I'll post a patch for that later. The remaining 109 for google.com and
hostmatch()
requires a very intrusive patch however since it would require to add a
size_t to struct hostname (aka add Howard Chu:s berval string) and that
struct is used _alot_
(which also means that there can be other winnings down the line besides
the certcheck since the hostname length is probably used a bit).

And then there are still about 3xx calls to strlen left for google.com that
as of yet have an unknown source.

/HH

>
> --
>
> / 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
Received on 2022-02-05