タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

pythonとoptimizeとtipsに関するishideoのブックマーク (3)

  • Pythonを高速にするTips集

    この記事は,Pythonを少しでも高速に実行するための方法をまとめたTips集です. 随時更新予定です. グローバル名前空間で大きな処理を書かない Pythonではメソッド内に処理を書かずにグローバル名前空間に処理を書くこともできます。 Pythonは変数アクセスを名前空間ごとの辞書(ハッシュマップみたいなもの)で検索することで実現しています。 グローバル名前空間の辞書にはデフォルトの状態でいくつかの要素が追加されているので、メソッド内でローカル変数にアクセスする場合に比べて変数アクセスのコストが重くなります。 なので、グローバル名前空間でforループなどを回すと変数アクセスのコストが無視できなくなるので、forループを回すなどの大きな処理を行う場合はメソッド内に処理を書くようにしましょう。 グローバル名前空間にforループの処理をべた書きした場合と、メソッド内に同じ処理を書いた場合での実

  • PythonSpeed/PerformanceTips - Python Wiki

    This page is devoted to various tips and tricks that help improve the performance of your Python programs. Wherever the information comes from someone else, I've tried to identify the source. Python has changed in some significant ways since I first wrote my "fast python" page in about 1996, which means that some of the orderings will have changed. I migrated it to the Python wiki in hopes others

  • 1