# timeit_compare
Conveniently measure and compare the execution times of multiple statements.
------------------------------
## Installation
To install the package, run the following command:
```commandline
pip install timeit_compare
```
------------------------------
## Usage
Here is a simple example from the timeit library documentation:
```pycon
>>> from timeit_compare import cmp
>>> cmp(
... "'-'.join(str(n) for n in range(100))",
... "'-'.join([str(n) for n in range(100)])",
... "'-'.join(map(str, range(100)))"
... )
timing now...
|████████████| 21/21 completed
Table. Comparison Results (unit: s)
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
Idx Mean ↓ Median Min Max Stdev Stmt
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 5.9e-6 75.7% █████▎ 5.9e-6 5.9e-6 6.0e-6 3.8e-8 '-'.join([str(n) for n in range(100)])
2 7.3e-6 93.4% ██████▌ 7.3e-6 7.2e-6 7.4e-6 7.6e-8 '-'.join(map(str, range(100)))
0 7.8e-6 100.% ███████ 7.8e-6 7.7e-6 8.0e-6 1.1e-7 '-'.join(str(n) for n in range(100))
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
7 runs, 10290 loops each, total time 1.509s
```
The table shows some basic descriptive statistics on the execution time of each
statement for comparison, including mean, median, minimum, maximum, and standard
deviation.
In a command line interface, call as follows:
```commandline
python -m timeit_compare - "'-'.join(str(n) for n in range(100))" - "'-'.join([str(n) for n in range(100)])" - "'-'.join(map(str, range(100)))"
```
Raw data
{
"_id": null,
"home_page": "https://github.com/AomandeNiuma/timeit_compare",
"name": "timeit-compare",
"maintainer": "Liu Wei",
"docs_url": null,
"requires_python": ">=3.6.0",
"maintainer_email": "23S112099@stu.hit.edu.cn",
"keywords": "timeit_compare, timeit, performance",
"author": "Liu Wei",
"author_email": "23S112099@stu.hit.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/cb/e9/b81bb0dcf48904708d506fa541f24e2cfe44141c62158bfb2f9a532871eb/timeit_compare-1.4.2.tar.gz",
"platform": null,
"description": "# timeit_compare\r\n\r\nConveniently measure and compare the execution times of multiple statements.\r\n\r\n------------------------------\r\n\r\n## Installation\r\n\r\nTo install the package, run the following command:\r\n\r\n```commandline\r\npip install timeit_compare\r\n```\r\n\r\n------------------------------\r\n\r\n## Usage\r\n\r\nHere is a simple example from the timeit library documentation:\r\n\r\n```pycon\r\n>>> from timeit_compare import cmp\r\n>>> cmp(\r\n... \"'-'.join(str(n) for n in range(100))\",\r\n... \"'-'.join([str(n) for n in range(100)])\",\r\n... \"'-'.join(map(str, range(100)))\"\r\n... )\r\ntiming now...\r\n|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 21/21 completed\r\n Table. Comparison Results (unit: s) \r\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n Idx Mean \u2193 Median Min Max Stdev Stmt \r\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n 1 5.9e-6 75.7% \u2588\u2588\u2588\u2588\u2588\u258e 5.9e-6 5.9e-6 6.0e-6 3.8e-8 '-'.join([str(n) for n in range(100)]) \r\n 2 7.3e-6 93.4% \u2588\u2588\u2588\u2588\u2588\u2588\u258c 7.3e-6 7.2e-6 7.4e-6 7.6e-8 '-'.join(map(str, range(100))) \r\n 0 7.8e-6 100.% \u2588\u2588\u2588\u2588\u2588\u2588\u2588 7.8e-6 7.7e-6 8.0e-6 1.1e-7 '-'.join(str(n) for n in range(100)) \r\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n7 runs, 10290 loops each, total time 1.509s \r\n```\r\n\r\nThe table shows some basic descriptive statistics on the execution time of each\r\nstatement for comparison, including mean, median, minimum, maximum, and standard\r\ndeviation.\r\n\r\nIn a command line interface, call as follows:\r\n\r\n```commandline\r\npython -m timeit_compare - \"'-'.join(str(n) for n in range(100))\" - \"'-'.join([str(n) for n in range(100)])\" - \"'-'.join(map(str, range(100)))\"\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Conveniently measure and compare the execution times of multiple statements.",
"version": "1.4.2",
"project_urls": {
"Homepage": "https://github.com/AomandeNiuma/timeit_compare"
},
"split_keywords": [
"timeit_compare",
" timeit",
" performance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cbe9b81bb0dcf48904708d506fa541f24e2cfe44141c62158bfb2f9a532871eb",
"md5": "be29c26d6d04dd5ba5b21db7d643b5fe",
"sha256": "62632febbb9df8cbb2796a3b4374d6f123cb4f35e1a35f469bb4eb5394c406b5"
},
"downloads": -1,
"filename": "timeit_compare-1.4.2.tar.gz",
"has_sig": false,
"md5_digest": "be29c26d6d04dd5ba5b21db7d643b5fe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 11571,
"upload_time": "2025-01-11T05:04:27",
"upload_time_iso_8601": "2025-01-11T05:04:27.804789Z",
"url": "https://files.pythonhosted.org/packages/cb/e9/b81bb0dcf48904708d506fa541f24e2cfe44141c62158bfb2f9a532871eb/timeit_compare-1.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-11 05:04:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AomandeNiuma",
"github_project": "timeit_compare",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "timeit-compare"
}