test_message.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:capnpy 作者: antocuni 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号