Skip to content

Instantly share code, notes, and snippets.

@georgevanburgh
Created January 5, 2016 01:48
Show Gist options
  • Save georgevanburgh/fd22e5eac8b5e1cf6040 to your computer and use it in GitHub Desktop.
Save georgevanburgh/fd22e5eac8b5e1cf6040 to your computer and use it in GitHub Desktop.
An attempt to find the closest TwitchTV chat server.
import requests
toBenchmark = ["http://192.16.64.174", "http://192.16.64.175", "http://192.16.64.176", "http://192.16.64.177", "http://192.16.64.178", "http://192.16.64.179", "http://192.16.64.205", "http://192.16.64.206", "http://192.16.64.207", "http://192.16.64.208", "http://192.16.64.209", "http://192.16.64.210", "http://192.16.64.211"]
TIMES_TO_FETCH = 10
for server in toBenchmark:
sum = 0.0
for i in range(TIMES_TO_FETCH):
sum += requests.get(server).elapsed.total_seconds() * 1000
print("Time for {}: {}ms".format(server, sum/TIMES_TO_FETCH))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment