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
评论列表
文章目录