MCPcopy Create free account
hub / github.com/0x676e67/wreq-python / main

Function main

benchmark/bench.py:410–449  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

408
409
410def main():
411 response_sizes = ["20k", "50k", "200k"]
412 requests_number = 200
413 thread_counts = [1, 8, 32]
414
415 sync_packages = [
416 ("tls_client", tls_client.Session),
417 ("httpx", httpx.Client),
418 ("requests", requests.Session),
419 ("niquests", niquests.Session),
420 ("rnet", rnet.BlockingClient),
421 ("curl_cffi", curl_cffi.requests.Session),
422 ("pycurl", PycurlSession),
423 ]
424 async_packages = [
425 ("httpx", httpx.AsyncClient),
426 ("aiohttp", aiohttp.ClientSession),
427 ("rnet", rnet.Client),
428 ("curl_cffi", curl_cffi.requests.AsyncSession),
429 ]
430
431 sync_packages = add_package_version(sync_packages)
432 async_packages = add_package_version(async_packages)
433
434 all_results = []
435
436 for size in response_sizes:
437 url = f"http://127.0.0.1:8000/{size}"
438
439 all_results += run_sync_tests(sync_packages, url, requests_number)
440 all_results += run_async_tests(async_packages, url, requests_number)
441
442 for threads in thread_counts:
443 all_results += run_threaded_tests(
444 sync_packages, url, requests_number, threads
445 )
446
447 df = pd.DataFrame(all_results)
448 df.to_csv("benchmark_results.csv", index=False)
449 plot_benchmark_multi(df, "benchmark_multi.jpg")
450
451
452if __name__ == "__main__":

Callers 1

bench.pyFile · 0.70

Calls 5

add_package_versionFunction · 0.85
run_sync_testsFunction · 0.85
run_async_testsFunction · 0.85
run_threaded_testsFunction · 0.85
plot_benchmark_multiFunction · 0.85

Tested by

no test coverage detected