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: Gavin Henry via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 27 Jan 2022 11:25:36 +0000

> Perhaps the win was from reducing strlen() calls? They are often overused, and while they can be optimized to some extent, they are inherently slow at runtime. Unless a compiler is smart enough to detect a string constant, where x is a constant replacing strlen(x) with (sizeof(x)-1) can be a win - which may have been what jogged this memory...

Yes, it was strlen. My apologies. They switch to berval types:

       typedef struct berval {
           ber_len_t bv_len;
           char *bv_val;
       } BerValue, *BerVarray;

https://www.openldap.org/software//man.cgi?query=ber_free&sektion=3&apropos=0&manpath=OpenLDAP+2.4-Release
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-01-27