跳转到主要内容

美观且Python风格的基准测试引擎。

项目描述

true-north

美观、强大且Python风格的Python代码基准测试引擎。

功能

  • 遵循基准测试的最佳实践,以产生最可靠的结果。
  • 检测缓存和副作用。
  • 跟踪内存使用和分配(可选)。
  • 指令跟踪,以便可重复的基准测试(可选)。
  • 100%类型安全。
  • 零依赖。
  • 高度可配置。
  • 漂亮的彩色输出。
  • 包含CLI以发现和运行所有基准测试。
  • 友好的API,可让您在基准测试之上编写自己的逻辑。
sorting algorithms
  list.sort
    possible side-effect detected: slowest iteration x21 slower than fastest
    5k   loops, best of 5:  43.579 us ±  12.681 us                 ████▇
              11 ops, 3961 ns/op
  sorted
    5k   loops, best of 5:  43.911 us ±   3.697 us    x1.01 slower █████
              11 ops, 3991 ns/op
  insert_sort
    2    loops, best of 5: 100.662 ms ± 111.725 us x2309.85 slower █████
      11_683_767 ops,    8 ns/op

安装

python3 -m pip install true-north

使用

import true_north

group = true_north.Group()

@group.add
def math_sorted(r):
    val = [1, 2, 3] * 300
    # timer start before entering the loop
    # and stops when leaving it
    for _ in r:
        sorted(val)

# run and print all benchmarks in the group
if __name__ == '__main__':
    group.print()

查看示例以获取更多示例和true-north.orsinium.dev以获取chad文档。

项目详情


下载文件

下载适合您的平台文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

true-north-0.3.0.tar.gz (17.9 kB 查看散列)

上传时间: 源代码

构建分发

true_north-0.3.0-py3-none-any.whl (17.6 kB 查看哈希值)

上传时间 Python 3

支持