I just followed an example how to make libcurl and libuv working together. I removed usage of global variables and tested the performance by downloading (not writing to disk) 4.4GB file. It works great. It is comparable to my experience with completion ports on Windows.

libcurl: 7.66.0
libuv: 1.33.1
code: 200

real	2m37,210s
user	0m2,297s
sys	0m6,527s

The source code of my playground:


I did not use C for about 15 years. I did never program in C at work. Recently I felt I want to satisfy my low level programming needs. I started with preparing my vim environment, wrote Makefile and simple usage of the libcurl library.

#include <stdio.h>
#include <curl/curl.h>

size_t on_write(char *ptr, size_t size, size_t nmemb, void *userdata) {
  return nmemb;

int on_progress(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) {
  printf("total %zu, now %zu\n", dltotal, dlnow);
  return 0;

int main(int argc, char** argv) {
  CURL *easy_handle = curl_easy_init();

  curl_easy_setopt(easy_handle, CURLOPT_NOPROGRESS, 0);
  curl_easy_setopt(easy_handle, CURLOPT_URL, "");

  curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, on_write);
  curl_easy_setopt(easy_handle, CURLOPT_XFERINFOFUNCTION, on_progress);


  return 0;