benchmark.py 文件源码

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

项目:python-ansimarkup 作者: gvalkov 项目源码 文件源码
def benchmark(stmt, n=1000, r=3):
    setup = (
        'from ansimarkup import parse;'
        'from colorama import Style as S, Fore as F;'
        'from termcolor import colored;'
        'from colr import color;'
        'from plumbum import colors;'
        'from pastel import colorize'
    )
    timer = Timer(stmt, setup=setup)
    best = min(timer.repeat(r, n))

    usec = best * 1e6 / n
    return usec
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号