{"id":13468715,"url":"https://github.com/nschloe/perfplot","last_synced_at":"2025-05-14T00:05:35.574Z","repository":{"id":37617338,"uuid":"82682313","full_name":"nschloe/perfplot","owner":"nschloe","description":":chart_with_upwards_trend: Performance analysis for Python snippets","archived":false,"fork":false,"pushed_at":"2024-11-14T19:53:40.000Z","size":959,"stargazers_count":1367,"open_issues_count":16,"forks_count":63,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-12T12:47:00.874Z","etag":null,"topics":["performance-analysis","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nschloe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"nschloe","ko-fi":"nschloe"}},"created_at":"2017-02-21T13:22:21.000Z","updated_at":"2025-04-06T18:40:11.000Z","dependencies_parsed_at":"2024-01-11T14:11:38.682Z","dependency_job_id":"dd122b61-f2cd-43e7-8f6b-159a9107eb2b","html_url":"https://github.com/nschloe/perfplot","commit_stats":{"total_commits":368,"total_committers":13,"mean_commits":"28.307692307692307","dds":"0.11956521739130432","last_synced_commit":"f224a8959f16757f327bfc8f4aba59218f1d0a46"},"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Fperfplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Fperfplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Fperfplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Fperfplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nschloe","download_url":"https://codeload.github.com/nschloe/perfplot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043384,"owners_count":22004943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["performance-analysis","python"],"created_at":"2024-07-31T15:01:17.342Z","updated_at":"2025-05-14T00:05:35.527Z","avatar_url":"https://github.com/nschloe.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/nschloe/perfplot\"\u003e\u003cimg alt=\"perfplot\" src=\"https://nschloe.github.io/perfplot/logo-perfplot.svg\" width=\"60%\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n[![PyPi Version](https://img.shields.io/pypi/v/perfplot.svg?style=flat-square)](https://pypi.org/project/perfplot)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/perfplot.svg?style=flat-square)](https://pypi.org/pypi/perfplot/)\n[![GitHub stars](https://img.shields.io/github/stars/nschloe/perfplot.svg?style=flat-square\u0026logo=github\u0026label=Stars\u0026logoColor=white)](https://github.com/nschloe/perfplot)\n[![Downloads](https://pepy.tech/badge/perfplot/month)](https://pepy.tech/project/perfplot)\n\n\u003c!--[![PyPi downloads](https://img.shields.io/pypi/dm/perfplot.svg?style=flat-square)](https://pypistats.org/packages/perfplot)--\u003e\n\n[![Discord](https://img.shields.io/static/v1?logo=discord\u0026logoColor=white\u0026label=chat\u0026message=on%20discord\u0026color=7289da\u0026style=flat-square)](https://discord.gg/hnTJ5MRX2Y)\n\n[![gh-actions](https://img.shields.io/github/workflow/status/nschloe/perfplot/ci?style=flat-square)](https://github.com/nschloe/perfplot/actions?query=workflow%3Aci)\n[![codecov](https://img.shields.io/codecov/c/github/nschloe/perfplot.svg?style=flat-square)](https://codecov.io/gh/nschloe/perfplot)\n[![LGTM](https://img.shields.io/lgtm/grade/python/github/nschloe/perfplot.svg?style=flat-square)](https://lgtm.com/projects/g/nschloe/perfplot)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)\n\nperfplot extends Python's [timeit](https://docs.python.org/3/library/timeit.html) by\ntesting snippets with input parameters (e.g., the size of an array) and plotting the\nresults.\n\nFor example, to compare different NumPy array concatenation methods, the script\n\n```python\nimport numpy as np\nimport perfplot\n\nperfplot.show(\n    setup=lambda n: np.random.rand(n),  # or setup=np.random.rand\n    kernels=[\n        lambda a: np.c_[a, a],\n        lambda a: np.stack([a, a]).T,\n        lambda a: np.vstack([a, a]).T,\n        lambda a: np.column_stack([a, a]),\n        lambda a: np.concatenate([a[:, None], a[:, None]], axis=1),\n    ],\n    labels=[\"c_\", \"stack\", \"vstack\", \"column_stack\", \"concat\"],\n    n_range=[2**k for k in range(25)],\n    xlabel=\"len(a)\",\n    # More optional arguments with their default values:\n    # logx=\"auto\",  # set to True or False to force scaling\n    # logy=\"auto\",\n    # equality_check=np.allclose,  # set to None to disable \"correctness\" assertion\n    # show_progress=True,\n    # target_time_per_measurement=1.0,\n    # max_time=None,  # maximum time per measurement\n    # time_unit=\"s\",  # set to one of (\"auto\", \"s\", \"ms\", \"us\", or \"ns\") to force plot units\n    # relative_to=1,  # plot the timings relative to one of the measurements\n    # flops=lambda n: 3*n,  # FLOPS plots\n)\n```\n\nproduces\n\n| ![](https://nschloe.github.io/perfplot/concat.svg) | ![](https://nschloe.github.io/perfplot/relative.svg) |\n| -------------------------------------------------- | ---------------------------------------------------- |\n\nClearly, `stack` and `vstack` are the best options for large arrays.\n\n(By default, perfplot asserts the equality of the output of all snippets, too.)\n\nIf your plot takes a while to generate, you can also use\n\n\u003c!--pytest-codeblocks:skip--\u003e\n\n```python\nperfplot.live(\n    # ...\n)\n```\n\n\u003cimg alt=\"live\" src=\"https://nschloe.github.io/perfplot/live.gif\" width=\"40%\"\u003e\n\nwith the same arguments as above. It will plot the updates live.\n\nBenchmarking and plotting can be separated. This allows multiple plots of the same data,\nfor example:\n\n\u003c!--pytest-codeblocks:skip--\u003e\n\n```python\nout = perfplot.bench(\n    # same arguments as above (except the plot-related ones, like time_unit or log*)\n)\nout.show()\nout.save(\"perf.png\", transparent=True, bbox_inches=\"tight\")\n```\n\nOther examples:\n\n- [Making a flat list out of list of lists in Python](https://stackoverflow.com/a/45323085/353337)\n- [Most efficient way to map function over numpy array](https://stackoverflow.com/a/46470401/353337)\n- [numpy: most efficient frequency counts for unique values in an array](https://stackoverflow.com/a/43096495/353337)\n- [Most efficient way to reverse a numpy array](https://stackoverflow.com/a/44921013/353337)\n- [How to add an extra column to an numpy array](https://stackoverflow.com/a/40218298/353337)\n- [Initializing numpy matrix to something other than zero or one](https://stackoverflow.com/a/45006691/353337)\n\n### Installation\n\nperfplot is [available from the Python Package\nIndex](https://pypi.org/project/perfplot/), so simply do\n\n```\npip install perfplot\n```\n\nto install.\n\n### Testing\n\nTo run the perfplot unit tests, check out this repository and type\n\n```\ntox\n```\n\n### License\n\nThis software is published under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html).\n","funding_links":["https://github.com/sponsors/nschloe","nschloe"],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnschloe%2Fperfplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnschloe%2Fperfplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnschloe%2Fperfplot/lists"}