Skip to content

Commit

Permalink
Small modifications for profile benchmark.
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesc Alted committed Jan 24, 2011
1 parent c445ab9 commit 588a3d9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions bench/eval-profile.py
Expand Up @@ -10,10 +10,10 @@

def compute_carray(sexpr, clevel, kernel):
# Uncomment the next for disabling threading
ca.set_nthreads(1)
ca.blosc_set_nthreads(1)
#ca.set_nthreads(1)
#ca.blosc_set_nthreads(1)
print("*** carray (using compression clevel = %d):" % clevel)
x = cx
x = cx # comment this for using numpy arrays in inputs
t0 = time()
cout = ca.eval(sexpr, kernel=kernel, cparams=ca.cparams(clevel))
print("Time for ca.eval (%s) --> %.3f" % (kernel, time()-t0,))
Expand All @@ -23,22 +23,23 @@ def compute_carray(sexpr, clevel, kernel):

if __name__=="__main__":

N = 1e7 # the number of elements in x
clevel = 0 # the compression level
N = 1e8 # the number of elements in x
clevel = 9 # the compression level
sexpr = "(x+1)<0"
sexpr = "(((.25*x + .75)*x - 1.5)*x - 2)<0"
doprofile = 1
#sexpr = "(((.25*x + .75)*x - 1.5)*x - 2)"
doprofile = 0

print("Creating inputs...")
#x = np.arange(N)
x = np.linspace(0,100,N)
x = np.arange(N)
#x = np.linspace(0,100,N)
cx = ca.carray(x, cparams=ca.cparams(clevel))

print("Evaluating '%s' with 10^%d points" % (sexpr, int(math.log10(N))))

# t0 = time()
# cout = ne.evaluate(sexpr)
# print "Time for numexpr --> %.3f" % (time()-t0,)
t0 = time()
cout = ne.evaluate(sexpr)
print "Time for numexpr --> %.3f" % (time()-t0,)

if doprofile:
import pstats
Expand Down

0 comments on commit 588a3d9

Please sign in to comment.