Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

really simple perf regression test #128

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions tests/perf_regression.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import pandas as pd
import numpy as np
import buckaroo
import time

def float_df(N,K):
return pd.DataFrame(
{chr(i+97): np.random.random_sample(N) for i in range(K)})

# %timeit float_df(100_000,20) 9ms on my laptop

def bw_do_stuff(df, **kwargs):
bw = buckaroo.BuckarooWidget(df, **kwargs)
#%timeit bw_do_stuff(float_df(100_000, 20)) 500 ms on my laptop


# the slow part is serialization to json, not summary stats
# %timeit bw_do_stuff2(float_df(10_000, 5)) 140 ms on my laptop
# %timeit bw_do_stuff2(float_df(100_000, 5)) 150ms on my laptop


def test_basic_instantiation():
t_start = time.time()
float_df(100_000, 20)
t_end = time.time()

np_time = t_end - t_start
assert np_time < 10

bw_start = time.time()
bw_do_stuff(float_df(10_000,5))
bw_end = time.time()
bw_time_1 = bw_end - bw_start

assert bw_time_1 < np_time * 50


bw_start2 = time.time()
bw_do_stuff(float_df(100_000,5))
bw_end2 = time.time()
bw_time_2 = bw_end2 - bw_start2

assert bw_time_2 < np_time * 50




47 changes: 47 additions & 0 deletions tests/perf_regression_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import pandas as pd
import numpy as np
import buckaroo
import time

def float_df(N,K):
return pd.DataFrame(
{chr(i+97): np.random.random_sample(N) for i in range(K)})

# %timeit float_df(100_000,20) 9ms on my laptop

def bw_do_stuff(df, **kwargs):
bw = buckaroo.BuckarooWidget(df, **kwargs)
#%timeit bw_do_stuff(float_df(100_000, 20)) 500 ms on my laptop


# the slow part is serialization to json, not summary stats
# %timeit bw_do_stuff2(float_df(10_000, 5)) 140 ms on my laptop
# %timeit bw_do_stuff2(float_df(100_000, 5)) 150ms on my laptop


def test_basic_instantiation():
t_start = time.time()
float_df(100_000, 20)
t_end = time.time()

np_time = t_end - t_start
assert np_time < 10

bw_start = time.time()
bw_do_stuff(float_df(10_000,5))
bw_end = time.time()
bw_time_1 = bw_end - bw_start

assert bw_time_1 < np_time * 50


bw_start2 = time.time()
bw_do_stuff(float_df(100_000,5))
bw_end2 = time.time()
bw_time_2 = bw_end2 - bw_start2

assert bw_time_2 < np_time * 50




Loading