cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_global_init performance

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 29 Aug 2013 12:32:00 +0200 (CEST)

On Thu, 29 Aug 2013, Tim Ruehsen wrote:

> It looks like that curl_global_init() initalizes OpenSSL though SSL is not
> needed. Kcachegrind show that SSL_load_error_strings() is alone responsible
> for nearly 50% impact.
>
> Isn't it possible to only initialize SSL stuff when needed ?

Not easily, no.

A major problem for libcurl (but not for wget) is that OpenSSL (and a few
other libs) don't provide thread-safe init functions. We need to make sure
that they are called in a safe way if we want to have the rest of the API work
fine in threads. Our way of making sure is to have curl_global_init().

A can think of other ways of doing it, but I can't think of a way that we can
introduce now without changing API/ABI...

To me, it is sad that such a seemingly mundane function like
SSL_load_error_strings() seems to be the offender here.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-08-29