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: a strlen update

From: Henrik Holst via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 14 Feb 2022 20:06:32 +0100

Den mån 14 feb. 2022 kl 09:11 skrev Daniel Stenberg via curl-library <
curl-library_at_lists.haxx.se>:

> On Thu, 10 Feb 2022, Daniel Stenberg via curl-library wrote:
>
> > In 7.81.0 this made 596 to 600 strlen() calls.
> >
> > In git master, this now makes 390 to 392 calls. A 33% reduction.
>
> After some more cleaning up by Henrik:
>
> 223 to 225 calls. A 62% reduction from 7.81.0!
>

To give these some real world numbers I used the timings provided by the
trace spent by each strlen call and for the https://google.com case the
savings vs 7.81.0 is aprox 80-100µs. While this is not an astronomical
number compared with the whole run (aprox 940000µs on my home machine) they
where #1 completely unnecessary, #2 very low hanging fruit, and #3 a bit
more important for applications that juggle around a lot fo easy handles
since actual cpu time is spent on the strlen calls vs the network transfer
(which is the vast majority of the time spent) which happens in parallel to
juggling around the easy handles.

Still if we can eliminate the unnecessary call to poll in the multi
interface that would alone make a similar saving (since they are syscalls
they are much much more heavy) so there are still some further gains to be
made.

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


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-02-14