From 127fb1144d431b80bdc6edc8b72fd751024977ac Mon Sep 17 00:00:00 2001 From: marcsello Date: Fri, 23 Oct 2020 18:21:39 +0200 Subject: [PATCH] Added some optimalizations --- benchmark3.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/benchmark3.py b/benchmark3.py index 24b94f3..02f2818 100644 --- a/benchmark3.py +++ b/benchmark3.py @@ -36,9 +36,13 @@ def independent_worker(result_queue, filename: str, timeout: float, target_url: prepared_curl.setopt(pycurl.URL, target_url) prepared_curl.setopt(pycurl.SSL_VERIFYPEER, 0) prepared_curl.setopt(pycurl.SSL_VERIFYHOST, 0) + prepared_curl.setopt(pycurl.SSL_VERIFYSTATUS, 0) # prepared_curl.setopt(pycurl.FORBID_REUSE, 0) prepared_curl.setopt(pycurl.HTTP_VERSION, pycurl.CURL_HTTP_VERSION_2_0) prepared_curl.setopt(pycurl.WRITEFUNCTION, lambda _: None) + prepared_curl.setopt(pycurl.NOSIGNAL, 1) + prepared_curl.setopt(pycurl.TCP_FASTOPEN, 1) + prepared_curl.setopt(pycurl.MAXCONNECTS, 500) # this does not change much, as we use only one connection per worker completed_jobs_list = blist() # O(log n) insert instead of python's O(n) @@ -51,6 +55,7 @@ def independent_worker(result_queue, filename: str, timeout: float, target_url: jobid = random.randint(0, 2147483647) prepared_curl.setopt(pycurl.HTTPPOST, [ ('file', ( + pycurl.FORM_CONTENTTYPE, 'audio/wave', pycurl.FORM_FILE, filename # Copying buffers from Python memory would be even slower... trust me )), ('description', (