2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-28 20:53:35 +08:00

pyon: ship ndarray data as bytes

this is about 3 times faster and since the encapsulating nparray() already
breaks json-compatibility, using a unicode string for json compatibility
is not necessary
This commit is contained in:
Robert Jördens 2016-05-21 19:08:22 +02:00
parent a9434d2e9f
commit 9e681590cb

View File

@ -141,14 +141,14 @@ class _Encoder:
r = "nparray("
r += self.encode(x.shape) + ", "
r += self.encode(x.dtype.str) + ", "
r += self.encode(base64.b64encode(x).decode())
r += self.encode(base64.b64encode(x.data))
r += ")"
return r
def encode_npscalar(self, x):
r = "npscalar("
r += self.encode(x.dtype.str) + ", "
r += self.encode(base64.b64encode(x).decode())
r += self.encode(base64.b64encode(x.data))
r += ")"
return r