run_test.py 文件源码

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

项目:IRPy 作者: TApplencourt 项目源码 文件源码
def test_performance_cache(self):
        """Compare the naive vanilla python lazy property
                (where property is written in C in the python stdlib)
            with our IRP lazy_property with the genealogy overhead

            Python 2.*: 1.25x Python 3.*: 1.75x
        """
        import timeit

        i = timeit.timeit('f.b0;', setup='from __main__ import BigTree; f = BigTree()', number=5000000)
        h = timeit.timeit('f.b0_vlp;', setup='from __main__ import BigTree; f = BigTree()', number=5000000)

        try:
            self.assertTrue(i < h*1.75)
        except AssertionError as e:
            raise e
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号