{ "info": { "author": "Anthony Sottile", "author_email": "asottile@umich.edu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython" ], "description": "[![Build Status](https://travis-ci.org/asottile/importtime-waterfall.svg?branch=master)](https://travis-ci.org/asottile/importtime-waterfall)\n\nimporttime-waterfall\n====================\n\nGenerate waterfalls from `-Ximporttime` tracing.\n\n## install\n\n`pip install importtime-waterfall`\n\n_note_: `importtime-waterfall` requires python3.7+\n\n## usage\n\n`importtime-waterfall` provides a single executable by the same name.\n\n`importtime-waterfall` takes a module name as a positional argument. This is\nthe module that will be profiled.\n\n### `--include-interpreter-startup`\n\nInclude tracing information of modules that are always imported as part of\ninterpreter startup. These are usually not interesting and so they are left\nout by default.\n\n### `--har`\n\nOutput as an [HTTP Archive][har-spec] or \"HAR\" file. Yes these aren't actual\nHTTP requests but it's an easy way to get a visualization using a standardized\ndata format.\n\nHAR unfortunaly doesn't have microsecond resolution so all times in the HAR\noutput are * 1000 (1 \u03bcs => 1ms).\n\nThe easiest way to use the output of this is to paste it into a\n[har viewer][har-viewer].\n\nI use the following:\n\n```console\n$ importtime-waterfall importtime_waterfall --har | xclip -selection c\n```\n\n[xclip][xclip] takes the output and puts it onto the clipboard.\nAlternatively, you can redirect to a file (`> foo.har`) and upload it that way.\n\nOnce pasted into the viewer you can inspect the output.\n\nThe blocked import time is represented as \"waiting\" (purple) and the self time\nis represented as \"receiving\" (grey). Generally when looking for slow modules\nlook for ones with large grey chunks.\n\n![](/img/waterfall.png)\n\n### `--graph`\n\n(this is the default display). Display the output as a tree. This doesn't\nreally add much on top of what `python -Ximporttime` already displays (but was\nuseful for developing / debugging this tool). I guess it's in human order\ninstead of reversed so that's something \ud83e\udd37.\n\nTimes displayed next to the module names are self-times in \u03bcs.\n\n```console\n$ importtime-waterfall importtime_waterfall\nimporttime_waterfall (419)\n argparse (864)\n re (599)\n enum (661)\n sre_compile (270)\n _sre (109)\n sre_parse (336)\n sre_constants (339)\n copyreg (161)\n gettext (1056)\n locale (820)\n datetime (768)\n time (234)\n math (57)\n _datetime (154)\n json (254)\n json.decoder (446)\n json.scanner (481)\n _json (193)\n json.encoder (443)\n subprocess (628)\n signal (1030)\n errno (101)\n _posixsubprocess (40)\n select (51)\n selectors (543)\n collections.abc (184)\n threading (578)\n traceback (394)\n linecache (162)\n tokenize (911)\n token (178)\n _weakrefset (217)\n typing (1469)\n```\n\n## success stories\n\nI used this to find a [24% speedup in `flake8`'s startup][flake8-speedup].\n\n## nitty-gritty how it works\n\n`importtime-waterfall` imports the profiled module in a subprocess while\nsetting the [`-Ximporttime`][x-importtime] flag. `importtime-waterfall` takes\npicks the best-of-5 (by total time) and uses that result. It parses the\n\"import time:\" lines and then outputs.\n\n[har-spec]: http://www.softwareishard.com/blog/har-12-spec/\n[har-viewer]: http://www.softwareishard.com/har/viewer/\n[xclip]: https://github.com/astrand/xclip\n[flake8-speedup]: https://gitlab.com/pycqa/flake8/merge_requests/250\n[x-importtime]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPROFILEIMPORTTIME\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/asottile/importtime-waterfall", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "importtime-waterfall", "package_url": "https://pypi.org/project/importtime-waterfall/", "platform": "", "project_url": "https://pypi.org/project/importtime-waterfall/", "project_urls": { "Homepage": "https://github.com/asottile/importtime-waterfall" }, "release_url": "https://pypi.org/project/importtime-waterfall/1.0.0/", "requires_dist": null, "requires_python": ">=3.7", "summary": "Generate waterfalls from `-Ximporttime` tracing.", "version": "1.0.0" }, "last_serial": 4877832, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "3e57fc7035fd4d0e6a568d7f93868fb6", "sha256": "7be00b0e032c3f1730aa44cae6eeb49e5d8b9c60a6ee430df8d6d5d9ed6c2a12" }, "downloads": -1, "filename": "importtime_waterfall-0.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3e57fc7035fd4d0e6a568d7f93868fb6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7", "size": 4316, "upload_time": "2018-10-16T03:27:50", "url": "https://files.pythonhosted.org/packages/d7/b0/b4fe097c99f1cac840b6c2d84b7e0b544c9e408980527fbe4d828f77025f/importtime_waterfall-0.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8248d8ac4f34ae2032cb5551e9f81c12", "sha256": "4d270c529c5c1abeeb33d83ae5a1f9c50a7cca93bf5ebddb49b8fa2a1b7cd51c" }, "downloads": -1, "filename": "importtime_waterfall-0.0.0.tar.gz", "has_sig": false, "md5_digest": "8248d8ac4f34ae2032cb5551e9f81c12", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 4305, "upload_time": "2018-10-16T03:27:51", "url": "https://files.pythonhosted.org/packages/ae/10/d861ebbbcc3b40e2bf3a1b24e2c16ceed41b80711a67101c5d6f9cbf7c97/importtime_waterfall-0.0.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "c098b7e16e891df652881933bd63278b", "sha256": "e65dbc4d23f0fd698ca3e8cfe767937b86f697e11790ac672aa86109792b3595" }, "downloads": -1, "filename": "importtime_waterfall-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c098b7e16e891df652881933bd63278b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7", "size": 5925, "upload_time": "2019-02-28T06:47:04", "url": "https://files.pythonhosted.org/packages/1d/5c/a299cf9f5748cc13f506934e2fa3ea5bbc9584946c0a773dc5104cb770f2/importtime_waterfall-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c4d5ce5ed6b378767c76a52c6cefaa8e", "sha256": "8140eb8e1774a39d426df82220f36b17d78ccbbba2adc75466979a315395f391" }, "downloads": -1, "filename": "importtime_waterfall-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c4d5ce5ed6b378767c76a52c6cefaa8e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 5544, "upload_time": "2019-02-28T06:47:06", "url": "https://files.pythonhosted.org/packages/0c/f8/0d33c4d69344cb55116a656ef103b499f69a5f33f748ac0cd32c297cc955/importtime_waterfall-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c098b7e16e891df652881933bd63278b", "sha256": "e65dbc4d23f0fd698ca3e8cfe767937b86f697e11790ac672aa86109792b3595" }, "downloads": -1, "filename": "importtime_waterfall-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c098b7e16e891df652881933bd63278b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7", "size": 5925, "upload_time": "2019-02-28T06:47:04", "url": "https://files.pythonhosted.org/packages/1d/5c/a299cf9f5748cc13f506934e2fa3ea5bbc9584946c0a773dc5104cb770f2/importtime_waterfall-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c4d5ce5ed6b378767c76a52c6cefaa8e", "sha256": "8140eb8e1774a39d426df82220f36b17d78ccbbba2adc75466979a315395f391" }, "downloads": -1, "filename": "importtime_waterfall-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c4d5ce5ed6b378767c76a52c6cefaa8e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 5544, "upload_time": "2019-02-28T06:47:06", "url": "https://files.pythonhosted.org/packages/0c/f8/0d33c4d69344cb55116a656ef103b499f69a5f33f748ac0cd32c297cc955/importtime_waterfall-1.0.0.tar.gz" } ] }