You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import time
import nengo
with nengo.Network() as model:
x = nengo.Ensemble(1000, 1)
p_neurons = nengo.Probe(x.neurons)
with nengo.Simulator(model) as sim:
sim.run(10)
# Repeated probe accesses
start = time.time()
for m in range(x.n_neurons):
sim.data[p_neurons][0, m]
print time.time() - start
# Only one probe access
start = time.time()
u = sim.data[p_neurons][0, :]
for m in range(x.n_neurons):
u[m]
print time.time() - start
It takes 37 seconds on my computer to access a mere 1000 spikes. It looks like every time sim.data[p_neurons] is accessed the entire array is re-copied. And of course the same effect is seen when accessing various time points.
Perhaps we should be caching the read-only object?
The text was updated successfully, but these errors were encountered:
It takes 37 seconds on my computer to access a mere 1000 spikes. It looks like every time
sim.data[p_neurons]
is accessed the entire array is re-copied. And of course the same effect is seen when accessing various time points.Perhaps we should be caching the read-only object?
The text was updated successfully, but these errors were encountered: