Last active
October 12, 2018 17:08
-
-
Save ysinjab/fc36e6e816bbbe3e00d52893d8bc07f7 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 timeit import default_timer as timer | |
import seaborn as sns | |
import pandas as pd | |
import sys | |
times = {} | |
numbers = [] | |
for i in xrange(3000000): | |
start = timer() | |
numbers.append(random.randint(0, 100000)) | |
end = timer() | |
times[i] = {'time': (end - start), 'size': (float(sys.getsizeof(times)) / 1024) / 1024 } | |
data = [(t,value['time'], value['size']) for t, value in times.iteritems()] | |
df = pd.DataFrame(data, columns=['num','time', 'size']) | |
fig, ax = plt.subplots(2, 1,figsize=(15,8)) | |
sns.lineplot(x=df.index, y="time", data=df, ax=ax[0]) | |
sns.lineplot(x=df.index, y="size", data=df, ax=ax[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment