-
-
Save padix-key/975751d0f5b22c56835d19c25df6fdf2 to your computer and use it in GitHub Desktop.
Unzipped vs. zipped RCSB download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import gzip | |
import timeit | |
import numpy as np | |
PDB_ID = "4v6x" | |
def gzip_download(): | |
r = requests.get(f"https://files.rcsb.org/download/{PDB_ID}.cif.gz") | |
content = gzip.decompress(r.content) | |
def download(): | |
r = requests.get(f"https://files.rcsb.org/download/{PDB_ID}.cif") | |
content = r.content | |
num_runs = 1 | |
num_repetions = 10 | |
download_times = timeit.Timer(download).repeat(repeat=num_repetions, number=num_runs) | |
download_median = np.median(download_times) / num_runs | |
gzip_download_times = timeit.Timer(gzip_download).repeat(repeat=num_repetions, number=num_runs) | |
gzip_download_median = np.median(gzip_download_times) / num_runs | |
print(f'{download_median=}') | |
print(f'{gzip_download_median=}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment