Large complex array encoding is slow
markusr opened this issue · comments
Markus Roppelt commented
The following program takes about 1.5 seconds to run on my PC. It seems that no advantage of the a numpy-complex-array is taken. Can this be done faster?
import numpy as np
import msgpack
import msgpack_numpy as m
m.patch()
import time
if __name__ == '__main__':
t0 = time.time()
data = np.arange(25*5000, dtype=np.complex128)
encmsg = msgpack.packb(data)
orgmsg = msgpack.unpackb(encmsg)
print time.time() - t0
Lev E. Givon commented
I improved the speed of array encoding/decoding. I also improved the encoding efficiency for complex arrays by reducing the amount of bookkeeping data. Please try out the latest code on Github; if it solves the problem, I'll post a new release.
Markus Roppelt commented
I just tested the new code. It works and runs very fast now. (~0.0230 sec)
Thank you for your quick fix.