Created
May 28, 2016 04:26
-
-
Save kurozumi/6632c12f8835a9705265c3b6d9212640 to your computer and use it in GitHub Desktop.
【Python】Benchmarker.pyを使ってマルチスレッドの速度をチェックする方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from benchmarker import Benchmarker | |
import threading | |
def f(x): | |
x**2 | |
with Benchmarker(10000, width=20) as bench: | |
@bench("mt") | |
def _(bm): | |
for i in bm: | |
threading.Thread(target=f, args=(i,)).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment