diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2017-10-03 10:46:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-03 10:46:34 (GMT) |
commit | 1a87de7fcfa3c19f08e29047337c350b4a32b259 (patch) | |
tree | d95bb87f7d32b9146c3f92d0e6de38f39c560bc1 /Doc/using | |
parent | e8c368df22c344183627e7ef882bea1683fe6dbe (diff) | |
download | cpython-1a87de7fcfa3c19f08e29047337c350b4a32b259.zip cpython-1a87de7fcfa3c19f08e29047337c350b4a32b259.tar.gz cpython-1a87de7fcfa3c19f08e29047337c350b4a32b259.tar.bz2 |
bpo-31415: Add `-X importtime` option (GH-3490)
It shows show import time of each module.
It's useful for optimizing startup time.
Typical usage: python -X importtime -c 'import requests'
Diffstat (limited to 'Doc/using')
-rw-r--r-- | Doc/using/cmdline.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 5adad15..9c1c269 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -407,6 +407,10 @@ Miscellaneous options * ``-X showalloccount`` to output the total count of allocated objects for each type when the program finishes. This only works when Python was built with ``COUNT_ALLOCS`` defined. + * ``-X importtime`` to show how long each import takes. It shows module name, + cumulative time (including nested imports) and self time (exluding nested + imports). Note that its output may be broken in multi threaded application. + Typical usage is ``python3 -X importtime -c 'import asyncio'``. It also allows passing arbitrary values and retrieving them through the :data:`sys._xoptions` dictionary. @@ -423,6 +427,9 @@ Miscellaneous options .. versionadded:: 3.6 The ``-X showalloccount`` option. + .. versionadded:: 3.7 + The ``-X importtime`` option. + Options you shouldn't use ~~~~~~~~~~~~~~~~~~~~~~~~~ |