In [2]:
%load_ext autoreload
%autoreload 2
In [3]:
#from tests.benchmark import bench, multitime
import math
import cmath
import pandas as pd
import maths
from operator import mul
from itertools import islice, permutations, count, izip, imap, product, chain
from timeit import timeit
In [4]:
reduce(mul, [5, 5, 5, 5], 1)
Out[4]:
In [5]:
I = 100000
cores = 4
In [6]:
# def consume(iterator, n)
for i in izip(islice(count(1), 0, I, cores),
islice(count(2), 0, I, cores),
islice(count(3), 0, I, cores),
islice(count(4), 0, I, cores)):
print i
In [71]:
I = 24
cores = 3
In [72]:
maths.wallis(I, start=1, step=cores)
Out[72]:
In [73]:
maths.wallis(I, start=2, step=cores)
Out[73]:
In [74]:
maths.wallis(I, start=3, step=cores)
Out[74]:
In [66]:
maths.wallis(I, start=4, step=cores)
Out[66]:
In [67]:
maths.wallis(I, start=5, step=cores)
Out[67]:
In [ ]:
In [39]:
w = maths.wallis
In [103]:
b1 = bench(w, 1000000000)
print b1
In [104]:
b1.dataframe
Out[104]:
In [105]:
derp['Time4'] = b1.dataframe['Time']
derp
Out[105]:
In [106]:
derp['Avg_t'] = (derp['Time'] + derp['Time2'] + derp['Time3'] + derp['Time4'])/4
In [119]:
derp2 = derp.set_index('N')
In [123]:
derp2
Out[123]:
In [124]:
derp2.to_csv('derp.csv', sep='\t')
In [129]:
pd.read_table('derp.csv', index_col='N')
Out[129]:
In [ ]:
In [155]:
ggg = multitime(w, 100000, 5)
In [151]:
ggg
Out[151]:
In [147]:
for i in ggg:
print i
In [141]:
ggg.mean()
Out[141]:
In [69]:
buildsetof_N(3753475)
Out[69]:
In [23]:
buildsetof_N(10000000000)
Out[23]:
In [51]:
b1 = bench(w, 1)
print b1
b1 = bench(w, 1)
print b1
b1 = bench(w, 1)
print b1
In [ ]: