feat: improve marshaller performance (#264)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import cython
|
import cython
|
||||||
|
|
||||||
from ..signature cimport SignatureTree
|
from ..signature cimport SignatureTree, SignatureType, Variant
|
||||||
|
|
||||||
|
|
||||||
cdef object PACK_UINT32
|
cdef object PACK_UINT32
|
||||||
@@ -28,16 +28,17 @@ cdef class Marshaller:
|
|||||||
)
|
)
|
||||||
cdef unsigned int _align(self, unsigned int n)
|
cdef unsigned int _align(self, unsigned int n)
|
||||||
|
|
||||||
cpdef write_boolean(self, object boolean, object _type)
|
cpdef write_boolean(self, object boolean, SignatureType type_)
|
||||||
|
|
||||||
@cython.locals(
|
@cython.locals(
|
||||||
written=cython.uint,
|
written=cython.uint,
|
||||||
)
|
)
|
||||||
cdef unsigned int _write_boolean(self, object boolean)
|
cdef unsigned int _write_boolean(self, object boolean)
|
||||||
|
|
||||||
cpdef write_string(self, object value, object _type)
|
cpdef write_string(self, object value, SignatureType type_)
|
||||||
|
|
||||||
@cython.locals(
|
@cython.locals(
|
||||||
|
buf=cython.bytearray,
|
||||||
value_len=cython.uint,
|
value_len=cython.uint,
|
||||||
signature_len=cython.uint,
|
signature_len=cython.uint,
|
||||||
written=cython.uint,
|
written=cython.uint,
|
||||||
@@ -49,49 +50,50 @@ cdef class Marshaller:
|
|||||||
)
|
)
|
||||||
cdef unsigned int _write_signature(self, bytes signature_bytes)
|
cdef unsigned int _write_signature(self, bytes signature_bytes)
|
||||||
|
|
||||||
cpdef write_array(self, object array, object type)
|
cpdef write_array(self, object array, SignatureType type_)
|
||||||
|
|
||||||
@cython.locals(
|
@cython.locals(
|
||||||
array_len=cython.uint,
|
array_len=cython.uint,
|
||||||
buf=cython.bytearray,
|
buf=cython.bytearray,
|
||||||
written=cython.uint,
|
written=cython.uint,
|
||||||
token=cython.str,
|
token=cython.str,
|
||||||
|
child_type=SignatureType,
|
||||||
array_len_packed=cython.bytes,
|
array_len_packed=cython.bytes,
|
||||||
size=cython.uint,
|
size=cython.uint,
|
||||||
writer=cython.object,
|
writer=cython.object,
|
||||||
packer=cython.object,
|
packer=cython.object,
|
||||||
i=cython.uint,
|
i=cython.uint,
|
||||||
)
|
)
|
||||||
cdef unsigned int _write_array(self, object array, object type)
|
cdef unsigned int _write_array(self, object array, SignatureType type_)
|
||||||
|
|
||||||
cpdef write_struct(self, object array, object type)
|
cpdef write_struct(self, object array, SignatureType type_)
|
||||||
|
|
||||||
@cython.locals(
|
@cython.locals(
|
||||||
written=cython.uint,
|
written=cython.uint,
|
||||||
i=cython.uint,
|
i=cython.uint,
|
||||||
)
|
)
|
||||||
cdef unsigned int _write_struct(self, object array, object type)
|
cdef unsigned int _write_struct(self, cython.list array, SignatureType type_)
|
||||||
|
|
||||||
cpdef write_variant(self, object variant, object type)
|
cpdef write_variant(self, Variant variant, SignatureType type_)
|
||||||
|
|
||||||
@cython.locals(
|
@cython.locals(
|
||||||
written=cython.uint,
|
written=cython.uint,
|
||||||
signature=cython.str,
|
signature=cython.str,
|
||||||
signature_bytes=cython.bytes,
|
signature_bytes=cython.bytes,
|
||||||
)
|
)
|
||||||
cdef unsigned int _write_variant(self, object variant, object type)
|
cdef unsigned int _write_variant(self, Variant variant, SignatureType type_)
|
||||||
|
|
||||||
@cython.locals(
|
@cython.locals(
|
||||||
written=cython.uint,
|
written=cython.uint,
|
||||||
size=cython.uint,
|
size=cython.uint,
|
||||||
)
|
)
|
||||||
cdef unsigned int _write_single(self, object type_, object body)
|
cdef unsigned int _write_single(self, SignatureType type_, object body)
|
||||||
|
|
||||||
@cython.locals(
|
@cython.locals(
|
||||||
written=cython.uint,
|
written=cython.uint,
|
||||||
t=cython.str,
|
t=cython.str,
|
||||||
)
|
)
|
||||||
cpdef write_dict_entry(self, object type_, object body)
|
cpdef write_dict_entry(self, cython.list dict_entry, SignatureType type_)
|
||||||
|
|
||||||
cpdef marshall(self)
|
cpdef marshall(self)
|
||||||
|
|
||||||
@@ -103,5 +105,6 @@ cdef class Marshaller:
|
|||||||
size=cython.uint,
|
size=cython.uint,
|
||||||
writer=cython.object,
|
writer=cython.object,
|
||||||
packer=cython.object,
|
packer=cython.object,
|
||||||
|
type_=SignatureType,
|
||||||
)
|
)
|
||||||
cdef _construct_buffer(self)
|
cdef _construct_buffer(self)
|
||||||
|
|||||||
Reference in New Issue
Block a user