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.

a strlen update

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 10 Feb 2022 09:27:01 +0100 (CET)

Hello,

In a previous mail here [1], I counted strlens done by curl. This then
triggered some work, mostly by Henrik Holst, to update code to not use
strlen() unnecessarily when it can avoid it.

I did a quick follow-up count today. I don't recall the exact build options I
used the last time, so I rebuilt 7.81.0 and current git master with the same
set now and ran a comparison:

  ltrace ./src/curl -Ls https://google.com/ -o /dev/null 2>&1 | grep strlen

In 7.81.0 this made 596 to 600 strlen() calls.

In git master, this now makes 390 to 392 calls. A 33% reduction.

(This used OpenSSL/1.1.1m and google.com speaks HTTP/2 and as said before,
makes a redirect)

[1] = https://curl.se/mail/lib-2022-01/0125.html

-- 
  / 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-10