mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
ruff lint fix
This commit is contained in:
parent
50c8b2ca2e
commit
80ccca8827
29 changed files with 375 additions and 434 deletions
|
@ -2,11 +2,12 @@
|
|||
|
||||
import argparse
|
||||
import sqlite3
|
||||
|
||||
from faker import Faker
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filename')
|
||||
parser.add_argument('-c', '--count', type=int)
|
||||
parser.add_argument("filename")
|
||||
parser.add_argument("-c", "--count", type=int)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -14,7 +15,7 @@ conn = sqlite3.connect(args.filename)
|
|||
cursor = conn.cursor()
|
||||
|
||||
# Create the user table
|
||||
cursor.execute('''
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS user (
|
||||
id INTEGER PRIMARY KEY,
|
||||
first_name TEXT,
|
||||
|
@ -26,7 +27,7 @@ cursor.execute('''
|
|||
state TEXT,
|
||||
zipcode TEXT
|
||||
)
|
||||
''')
|
||||
""")
|
||||
|
||||
fake = Faker()
|
||||
for _ in range(args.count):
|
||||
|
@ -39,10 +40,13 @@ for _ in range(args.count):
|
|||
state = fake.state_abbr()
|
||||
zipcode = fake.zipcode()
|
||||
|
||||
cursor.execute('''
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO user (first_name, last_name, email, phone_number, address, city, state, zipcode)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
''', (first_name, last_name, email, phone_number, address, city, state, zipcode))
|
||||
""",
|
||||
(first_name, last_name, email, phone_number, address, city, state, zipcode),
|
||||
)
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib
|
||||
import csv
|
||||
|
||||
font = {'family' : 'normal',
|
||||
'weight' : 'bold',
|
||||
'size' : 22}
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
matplotlib.rcParams.update({'font.size': 22})
|
||||
font = {"family": "normal", "weight": "bold", "size": 22}
|
||||
|
||||
file_name = 'results.csv'
|
||||
matplotlib.rcParams.update({"font.size": 22})
|
||||
|
||||
file_name = "results.csv"
|
||||
threads = []
|
||||
p50_values = []
|
||||
p95_values = []
|
||||
|
@ -22,34 +21,34 @@ p99_limbo = []
|
|||
p999_limbo = []
|
||||
|
||||
# Parse the CSV file
|
||||
with open(file_name, 'r') as csvfile:
|
||||
with open(file_name, "r") as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
if row['system'] == 'rusqlite':
|
||||
threads.append(int(row['count']))
|
||||
p50_values.append(float(row['p50']) / 1e3)
|
||||
p95_values.append(float(row['p95']) / 1e3)
|
||||
p99_values.append(float(row['p99']) / 1e3)
|
||||
p999_values.append(float(row['p999']) / 1e3)
|
||||
if row["system"] == "rusqlite":
|
||||
threads.append(int(row["count"]))
|
||||
p50_values.append(float(row["p50"]) / 1e3)
|
||||
p95_values.append(float(row["p95"]) / 1e3)
|
||||
p99_values.append(float(row["p99"]) / 1e3)
|
||||
p999_values.append(float(row["p999"]) / 1e3)
|
||||
else:
|
||||
p95_limbo.append(float(row['p95']) / 1e3)
|
||||
p99_limbo.append(float(row['p99']) / 1e3)
|
||||
p999_limbo.append(float(row['p999']) / 1e3)
|
||||
p95_limbo.append(float(row["p95"]) / 1e3)
|
||||
p99_limbo.append(float(row["p99"]) / 1e3)
|
||||
p999_limbo.append(float(row["p999"]) / 1e3)
|
||||
|
||||
plt.figure(figsize=(10, 6))
|
||||
plt.plot(threads, p999_values, label='rusqlite (p999)', linestyle='solid', marker='$\u2217$')
|
||||
plt.plot(threads, p999_limbo, label='limbo (p999)', linestyle='solid', marker='$\u2217$')
|
||||
plt.plot(threads, p99_values, label='rusqlite (p99)', linestyle='solid', marker='$\u002B$')
|
||||
plt.plot(threads, p99_limbo, label='limbo (p99)', linestyle='solid', marker='$\u002B$')
|
||||
#plt.plot(threads, p95_values, label='p95', linestyle='solid', marker="$\u25FE$")
|
||||
#plt.plot(threads, p50_values, label='p50', linestyle='solid', marker="$\u25B2$")
|
||||
plt.plot(threads, p999_values, label="rusqlite (p999)", linestyle="solid", marker="$\u2217$")
|
||||
plt.plot(threads, p999_limbo, label="limbo (p999)", linestyle="solid", marker="$\u2217$")
|
||||
plt.plot(threads, p99_values, label="rusqlite (p99)", linestyle="solid", marker="$\u002b$")
|
||||
plt.plot(threads, p99_limbo, label="limbo (p99)", linestyle="solid", marker="$\u002b$")
|
||||
# plt.plot(threads, p95_values, label='p95', linestyle='solid', marker="$\u25FE$")
|
||||
# plt.plot(threads, p50_values, label='p50', linestyle='solid', marker="$\u25B2$")
|
||||
|
||||
plt.yscale("log")
|
||||
plt.xlabel('Number of Tenants')
|
||||
plt.ylabel('Latency (µs)')
|
||||
plt.xlabel("Number of Tenants")
|
||||
plt.ylabel("Latency (µs)")
|
||||
plt.grid(True)
|
||||
|
||||
plt.legend()
|
||||
|
||||
plt.tight_layout()
|
||||
plt.savefig('latency_distribution.pdf')
|
||||
plt.savefig("latency_distribution.pdf")
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
import argparse
|
||||
import sqlite3
|
||||
|
||||
from faker import Faker
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filename')
|
||||
parser.add_argument('-c', '--count', type=int)
|
||||
parser.add_argument("filename")
|
||||
parser.add_argument("-c", "--count", type=int)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -14,7 +15,7 @@ conn = sqlite3.connect(args.filename)
|
|||
cursor = conn.cursor()
|
||||
|
||||
# Create the user table
|
||||
cursor.execute('''
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS user (
|
||||
id INTEGER PRIMARY KEY,
|
||||
first_name TEXT,
|
||||
|
@ -26,7 +27,7 @@ cursor.execute('''
|
|||
state TEXT,
|
||||
zipcode TEXT
|
||||
)
|
||||
''')
|
||||
""")
|
||||
|
||||
fake = Faker()
|
||||
for _ in range(args.count):
|
||||
|
@ -39,10 +40,13 @@ for _ in range(args.count):
|
|||
state = fake.state_abbr()
|
||||
zipcode = fake.zipcode()
|
||||
|
||||
cursor.execute('''
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO user (first_name, last_name, email, phone_number, address, city, state, zipcode)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
''', (first_name, last_name, email, phone_number, address, city, state, zipcode))
|
||||
""",
|
||||
(first_name, last_name, email, phone_number, address, city, state, zipcode),
|
||||
)
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib
|
||||
import csv
|
||||
|
||||
font = {'family' : 'normal',
|
||||
'weight' : 'bold',
|
||||
'size' : 22}
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
matplotlib.rcParams.update({'font.size': 22})
|
||||
font = {"family": "normal", "weight": "bold", "size": 22}
|
||||
|
||||
file_name = 'results.csv'
|
||||
matplotlib.rcParams.update({"font.size": 22})
|
||||
|
||||
file_name = "results.csv"
|
||||
threads = []
|
||||
p50_values = []
|
||||
p95_values = []
|
||||
|
@ -18,27 +17,27 @@ p99_values = []
|
|||
p999_values = []
|
||||
|
||||
# Parse the CSV file
|
||||
with open(file_name, 'r') as csvfile:
|
||||
with open(file_name, "r") as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
threads.append(int(row['count']))
|
||||
p50_values.append(float(row['p50']) / 1e3)
|
||||
p95_values.append(float(row['p95']) / 1e3)
|
||||
p99_values.append(float(row['p99']) / 1e3)
|
||||
p999_values.append(float(row['p999']) / 1e3)
|
||||
threads.append(int(row["count"]))
|
||||
p50_values.append(float(row["p50"]) / 1e3)
|
||||
p95_values.append(float(row["p95"]) / 1e3)
|
||||
p99_values.append(float(row["p99"]) / 1e3)
|
||||
p999_values.append(float(row["p999"]) / 1e3)
|
||||
|
||||
plt.figure(figsize=(10, 6))
|
||||
plt.plot(threads, p999_values, label='p999', linestyle='solid', marker='$\u2217$')
|
||||
plt.plot(threads, p99_values, label='p99', linestyle='solid', marker='$\u002B$')
|
||||
plt.plot(threads, p95_values, label='p95', linestyle='solid', marker="$\u25FE$")
|
||||
plt.plot(threads, p50_values, label='p50', linestyle='solid', marker="$\u25B2$")
|
||||
plt.plot(threads, p999_values, label="p999", linestyle="solid", marker="$\u2217$")
|
||||
plt.plot(threads, p99_values, label="p99", linestyle="solid", marker="$\u002b$")
|
||||
plt.plot(threads, p95_values, label="p95", linestyle="solid", marker="$\u25fe$")
|
||||
plt.plot(threads, p50_values, label="p50", linestyle="solid", marker="$\u25b2$")
|
||||
|
||||
plt.yscale("log")
|
||||
plt.xlabel('Number of Threads')
|
||||
plt.ylabel('Latency (µs)')
|
||||
plt.xlabel("Number of Threads")
|
||||
plt.ylabel("Latency (µs)")
|
||||
plt.grid(True)
|
||||
|
||||
plt.legend()
|
||||
|
||||
plt.tight_layout()
|
||||
plt.savefig('latency_distribution.pdf')
|
||||
plt.savefig("latency_distribution.pdf")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue