Created
June 22, 2023 13:27
-
-
Save dmoa/20cfd10004f28d9bcb6b7f8fd90ff738 to your computer and use it in GitHub Desktop.
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
from memcache import Client | |
from time import time | |
n = 100000 | |
def benchtime(fn): | |
oldtime = time() | |
fn() | |
return time() - oldtime | |
mc = Client(['127.0.0.1:11211']) | |
@benchtime | |
def bench(): | |
for i in range(n): | |
mc.set("%s" % i, i) | |
num_tests_run = 10 | |
total_value = 0 | |
for i in range(10): | |
current_value = (float(n) / bench) | |
total_value += current_value | |
print("%f queries/second" % (total_value / num_tests_run)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment