Last active
April 12, 2021 19:15
-
-
Save MichaelMauderer/6ed3cae60bd0048a82c269481c06c0b4 to your computer and use it in GitHub Desktop.
Benchmark Wip
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 matplotlib.pyplot as plt | |
import time | |
import pandas as pd | |
df = pd.read_csv('sample_data.csv') | |
x = df['x'] | |
y = df['y'] | |
color = df[['color_r', 'color_g', 'color_b', 'color_a']].values | |
start_time = time.perf_counter() | |
iterations = 1 | |
for _ in range(iterations): | |
plt.scatter(x=df['x'], y=df['y'], c=color) | |
plt.title('Scatter plot') | |
plt.xlabel('x') | |
plt.ylabel('y') | |
plt.show(block=False) | |
end_time = time.perf_counter() | |
result_time = (end_time - start_time) / iterations | |
print(f"time: {result_time}") |
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 numpy as np | |
import pandas as pd | |
n = 10_000_000 | |
data = { | |
'x': np.random.rand(n), | |
'y': np.random.rand(n), | |
'size': np.random.rand(n), | |
'color_r': np.random.rand(n), | |
'color_g': np.random.rand(n), | |
'color_b': np.random.rand(n), | |
'color_a': np.random.rand(n), | |
} | |
df = pd.DataFrame(data) | |
df.to_csv('./sample_data.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment