timeit-compare


Nametimeit-compare JSON
Version 1.4.1 PyPI version JSON
download
home_pagehttps://github.com/AomandeNiuma/timeit_compare
SummaryConveniently measure and compare the execution times of multiple statements.
upload_time2024-08-07 22:54:45
maintainerLiu Wei
docs_urlNone
authorLiu Wei
requires_python>=3.6.0
licenseMIT
keywords timeit_compare timeit performance
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/37/81/4c7cf5292860a315dfef4686aba8f5db4fdf862fa683e911a9a523363ab1/timeit_compare-1.4.1.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.1",
    "project_urls": {
        "Homepage": "https://github.com/AomandeNiuma/timeit_compare"
    },
    "split_keywords": [
        "timeit_compare",
        " timeit",
        " performance"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37814c7cf5292860a315dfef4686aba8f5db4fdf862fa683e911a9a523363ab1",
                "md5": "3ead22674f95ca8f2fb36bd3c68ca21c",
                "sha256": "a460302df8979b430a4aef3c11671ba4c563707f27e1b78b69c6b65d6700f560"
            },
            "downloads": -1,
            "filename": "timeit_compare-1.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3ead22674f95ca8f2fb36bd3c68ca21c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 11150,
            "upload_time": "2024-08-07T22:54:45",
            "upload_time_iso_8601": "2024-08-07T22:54:45.882068Z",
            "url": "https://files.pythonhosted.org/packages/37/81/4c7cf5292860a315dfef4686aba8f5db4fdf862fa683e911a9a523363ab1/timeit_compare-1.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-07 22:54:45",
    "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"
}
        
Elapsed time: 7.82358s