Skip to content

Instantly share code, notes, and snippets.

@lovasoa
Created July 11, 2019 10:47
Show Gist options
  • Save lovasoa/661257516d43dff6737b07aca66fb846 to your computer and use it in GitHub Desktop.
Save lovasoa/661257516d43dff6737b07aca66fb846 to your computer and use it in GitHub Desktop.
InfluxDB python client benchmark
def test(client, n):
"""Stupid test function"""
q = f"SELECT * FROM test LIMIT {n}"
client.query(q)
setup = """
from __main__ import test
from influxdb import InfluxDBClient
client = InfluxDBClient(
'localhost',
8086,
'root',
'root',
'my_db'
)
"""
if __name__ == '__main__':
import timeit
for n in range(0, 20000, 2000):
t = timeit.timeit(f"test(client, {n})", setup=setup, number=10)
print(n, t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment