diff options
Diffstat (limited to 'docs/src/quickstart/demo.pyx')
-rw-r--r-- | docs/src/quickstart/demo.pyx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/src/quickstart/demo.pyx b/docs/src/quickstart/demo.pyx index 8c25f8992..a475dd03c 100644 --- a/docs/src/quickstart/demo.pyx +++ b/docs/src/quickstart/demo.pyx @@ -12,6 +12,7 @@ def timeit(f, label): first_time = elapsed print label, elapsed, (100*elapsed/first_time), '% or', first_time/elapsed, 'x' + # Pure Python py_funcs = {'sin': sin} @@ -30,22 +31,22 @@ def integrate_f(a, b, N): """ in py_funcs timeit(py_funcs['integrate_f'], "Python") + # Just compiled def f0(x): - return x**2-x + return x**2-x def integrate_f0(a, b, N): - s = 0 - dx = (b-a)/N - for i in range(N): - s += f0(a+i*dx) - return s * dx + s = 0 + dx = (b-a)/N + for i in range(N): + s += f0(a+i*dx) + return s * dx timeit(integrate_f0, "Cython") - # Typed vars def f1(double x): @@ -63,7 +64,6 @@ def integrate_f1(double a, double b, int N): timeit(integrate_f1, "Typed vars") - # Typed func cdef double f2(double x) except? -2: |