LoginSignup
2
2

More than 5 years have passed since last update.

めざせpythonライブラリマスター (27)benchit

Posted at

【ライブラリ説明】

 ベンチマークテスト

【プログラム】

benchit.py
# -*- coding: utf-8 -*-

from benchit import BenchIt

b = BenchIt()

b.mark("Stuff Done")

for i in range(1,1000000):
    b.mark("In loop")
    pass  # more stuff done

b.mark("More stuff completed")
b.display()

【結果】

display
+----------------------+----------+------+--------+----------+---------+---------+
| Marker               | Method   | Line |  Loops | Avg Time | Runtime | Percent |
+----------------------+----------+------+--------+----------+---------+---------+
| Stuff Done           | <module> |    7 |      1 |  0.00000 | 0.00000 |    0.00 |
| In loop              | <module> |    9 | 999999 |  0.00000 | 1.47100 |   89.91 |
| More stuff completed | <module> |   12 |      1 |  0.01700 | 0.01700 |    1.04 |
+----------------------+----------+------+--------+----------+---------+---------+

【参考サイト】

 pypi
 github

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2