Closed kadrlica closed 6 years ago
>>> import numpy as np
>>> import numpy.lib.recfunctions as recfn
>>> from matplotlib import mlab
>>> x = np.recarray(10000,dtype=[('x',int),('y',int)])
>>> %timeit -r 10000 -n 1 mlab.rec_append_fields(x,['z'],[np.zeros(len(x))])
MatplotlibDeprecationWarning: The rec_append_fields function was deprecated in version 2.2.
1 loop, best of 10000: 140 µs per loop
>>> %timeit -r 10000 -n 1 recfn.rec_append_fields(x,['z'],[np.zeros(len(x))])
1 loop, best of 10000: 684 µs per loop
Note that I'm doing 1e4 explicit runs to avoid any potential caching issues.
Closed by kadrlica/ugali#14
Matplotlib b2.2 has started warning that
mlab.rec_append_fields
is deprecated. There is a drop-in replacement innumpy.lib.recfunctions
; however, it is a factor of 5x slower...