Retourner au contenu associé (journal : Le TapTempo du web, mais plus rapide)
Posté par superna (site web personnel) le 21 juin 2022 à 18:55. En réponse au journal Le TapTempo du web, mais plus rapide. Évalué à 4.
Avec libmicrohttpd (installé depuis un package debian sur Ubuntu 20.04):
Avec ./wrk -d10s -t4: Requests/sec: 217045.72 Transfer/sec: 31.69MB Code:
./wrk -d10s -t4:
Requests/sec: 217045.72 Transfer/sec: 31.69MB
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <microhttpd.h> static int avatar_location(void * cls, struct MHD_Connection * connection, const char * url, const char * method, const char * version, const char * upload_data, size_t * upload_data_size, void ** ptr) { struct MHD_Response * response; char location[] = "https://avatar.spacefox.fr/Renard-XXXX.png"; int ret; if (0 != strcmp(method, "GET")) return MHD_NO; /* unexpected method */ response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT); snprintf(&location[34], sizeof(location)-34, "%d.png", rand() % 11); MHD_add_response_header(response, "Location", location); ret = MHD_queue_response(connection, MHD_HTTP_FOUND, response); MHD_destroy_response(response); return ret; } int main(int argc, char ** argv) { struct MHD_Daemon * d; if (argc != 2) { printf("%s PORT\n", argv[0]); return 1; } srand(time(NULL)); d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION, atoi(argv[1]), NULL, NULL, &avatar_location, NULL, MHD_OPTION_END); if (d == NULL) return 1; (void) getc (stdin); MHD_stop_daemon(d); return 0; }
et
gcc main.c -lmicrohttpd -O3 -o ./taptempoweb
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
# C
Posté par superna (site web personnel) . En réponse au journal Le TapTempo du web, mais plus rapide. Évalué à 4.
Avec libmicrohttpd (installé depuis un package debian sur Ubuntu 20.04):
Avec
./wrk -d10s -t4:
Code:Requests/sec: 217045.72
Transfer/sec: 31.69MB
et