Skip to content

deepcopy is slow #912

@dizcza

Description

@dizcza

Neo DataObject has the __deepcopy__ function, but it's slow, compared to cloning the array only:

from copy import deepcopy
sts = [elephant.spike_train_generation.homogeneous_poisson_process(rate=10*pq.Hz, t_stop=1*pq.s) for _ in range(1000)]
%timeit deepcopy(sts)
191 ms ± 14.8 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%timeit [st.copy() for st in sts]
3.15 ms ± 500 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions