差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン | 最新のリビジョン両方とも次のリビジョン | ||
python:timeit [2020/09/11 17:03] – ともやん | python:timeit [2021/07/05 02:32] – ともやん | ||
---|---|---|---|
行 2: | 行 2: | ||
timeit モジュールは処理の実行時間を計測する。\\ | timeit モジュールは処理の実行時間を計測する。\\ | ||
- | <WRAP prewrap 100% #mincode> | + | <WRAP prewrap 100% mincode> |
<code python dir_walk.py> | <code python dir_walk.py> | ||
# | # | ||
行 68: | 行 68: | ||
**timeit.template (モンキーパッチ)**\\ | **timeit.template (モンキーパッチ)**\\ | ||
< | < | ||
- | <WRAP prewrap 100% #mincode> | + | <WRAP prewrap 100% mincode> |
<code python> | <code python> | ||
timeit.template = """ | timeit.template = """ | ||
行 83: | 行 83: | ||
===== timeit.timeit() の実装 ===== | ===== timeit.timeit() の実装 ===== | ||
- | <WRAP prewrap 100% #mincode> | + | <WRAP prewrap 100% mincode> |
<code python> | <code python> | ||
# Don't change the indentation of the template; the reindent() calls | # Don't change the indentation of the template; the reindent() calls | ||
行 100: | 行 100: | ||
</ | </ | ||
- | <WRAP prewrap 100% #mincode_long> | + | <WRAP prewrap 100% mincode_long> |
<code python> | <code python> | ||
class Timer: | class Timer: | ||
行 158: | 行 158: | ||
</ | </ | ||
- | <WRAP prewrap 100% #mincode> | + | <WRAP prewrap 100% mincode> |
<code python> | <code python> | ||
def timeit(stmt=" | def timeit(stmt=" | ||
行 167: | 行 167: | ||
</ | </ | ||
- | <WRAP prewrap 100% #mincode_long> | + | <WRAP prewrap 100% mincode_long> |
<code python Python38/ | <code python Python38/ | ||
#! / | #! / |