def test_copy_buffer(self, schema, benchmark):
# this is not really a dumps, but it is used as a baseline to compare
# the performance
if schema.__name__ != 'Capnpy':
pytest.skip('N/A')
#
def dumps_N(obj):
myobjs = (obj, obj)
res = 0
for i in range(self.N):
obj = myobjs[i%2]
res = obj._seg.buf[:]
return res
#
obj = get_obj(schema)
res = benchmark(dumps_N, obj)
assert type(res) is six.binary_type
评论列表
文章目录