forked from M-Labs/artiq
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:
parent
a9434d2e9f
commit
9e681590cb
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user