forked from M-Labs/artiq
1
0
Fork 0

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
1 changed files with 2 additions and 2 deletions

View File

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