diff options
author | Mario Mulansky <mario.mulansky@gmx.net> | 2014-09-30 12:50:56 +0200 |
---|---|---|
committer | Mario Mulansky <mario.mulansky@gmx.net> | 2014-09-30 12:50:56 +0200 |
commit | 68f2f8e6297be829d29ef428784ac0002348877b (patch) | |
tree | 2fed86db66edc2373521e279e2a1c2226a49322a /examples | |
parent | aeec6cfafed8df110e60743073cff6d778f65af0 (diff) |
cython version of spike dist, using memory views
Diffstat (limited to 'examples')
-rw-r--r-- | examples/perf_spike.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/perf_spike.py b/examples/perf_spike.py index 37154ae..5b1c1cc 100644 --- a/examples/perf_spike.py +++ b/examples/perf_spike.py @@ -17,7 +17,7 @@ def measure_perf(func, loops=10): times[i] = time.clock() - start return np.min(times) -print("# approximate number of spikes\texecution time [ms]") +print("# approximate number of spikes\tcython time [ms]\tpython time [ms]") # max times Ns = np.arange(10000, 50001, 10000) @@ -34,6 +34,9 @@ for N in Ns: # only up to T t2 = spk.add_auxiliary_spikes(t2[t2<N], N) - t = measure_perf(partial(spk.spike_distance, t1, t2)) + t_cython = measure_perf(partial(spk.spike_distance, t1, t2)) + + t_python = measure_perf(partial(spk.distances.spike_distance_python, + t1, t2)) - print("%d\t%.1f" % (N, t*1000)) + print("%d\t%.3f\t%.1f" % (N, t_cython*1000, t_python*1000)) |