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 <>
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;
Received on 2022-01-27