5 ms·
For comparison, I get the same sort of speed on my system: %timeit p = pickle.dumps(a) 1 loops, best of 3: 1.14 s per loop But tostring and fromstring
by aidos 11y ago
For comparison, I get the same sort of speed on my system:
%timeit p = pickle.dumps(a)
1 loops, best of 3: 1.14 s per loop
But tostring and fromstring run in a fraction of the time.
%timeit s = a.tostring()
1000 loops, best of 3: 1.13 ms per loop
%timeit b = np.fromstring(s).reshape(800, 600, 3)
1000 loops, best of 3: 1.57 ms per loop
np.all(a == b)
True