Skip to content

Instantly share code, notes, and snippets.

@cstamas

cstamas/perf.txt Secret

Created November 5, 2020 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cstamas/f87a12920d3c28e5db024dcd2f1a5d5f to your computer and use it in GitHub Desktop.
Save cstamas/f87a12920d3c28e5db024dcd2f1a5d5f to your computer and use it in GitHub Desktop.
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 697 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 525 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 713 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 663 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 652 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 567 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 708 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 590 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 688 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 602 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 720 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 588 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 710 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 600 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$ ./http2PerfTest.py
Loading test file...
Loaded 1561 artifact URLs
Testing HTTP/1.1 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/1.1 in 677 ms
Testing HTTP/2.0 performance with limit of 100 artifacts...
Artifacts were downloaded using HTTP/2.0 in 836 ms
cstamas@Urnebes ~/Worx/jbartece/http2performance (main *)$
diff --git a/http2PerfTest.py b/http2PerfTest.py
index 014c385..e85b3bc 100755
--- a/http2PerfTest.py
+++ b/http2PerfTest.py
@@ -3,18 +3,18 @@
import httpx
import asyncio
import time
+import io
limit = 100
+devnull = open("/dev/null", "wb")
async def getAndVerifyArtifact(client, httpVersion, url):
#print(url)
response = await client.get(url)
if response.status_code != 200 or response.http_version != httpVersion:
print("Failed to download", url, response.status_code, response.http_version)
- #else:
- # print(response.content)
-
-
+ else:
+ devnull.write(response.content)
async def downloadArtifacts(client, urls, httpVersion):
tasks = [asyncio.ensure_future(getAndVerifyArtifact(client, httpVersion, url)) for url in urls]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment