Skip to content

Instantly share code, notes, and snippets.

@ysinjab
Last active October 12, 2018 17:08
Show Gist options
  • Save ysinjab/fc36e6e816bbbe3e00d52893d8bc07f7 to your computer and use it in GitHub Desktop.
Save ysinjab/fc36e6e816bbbe3e00d52893d8bc07f7 to your computer and use it in GitHub Desktop.
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