{ "info": { "author": "Nir Soffer", "author_email": "nsoffer@redhat.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Operating System :: POSIX :: Linux", "Programming Language :: C", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries" ], "description": "==========\r\ncthreading\r\n==========\r\n\r\ncthreading implements Python 2 Lock, RLock, and Condition in C, speeding\r\nup threads synchronization and decreasing cpu usage.\r\n\r\nStatus: |travis|\r\n\r\n.. |travis| image:: https://travis-ci.org/nirs/cthreading.svg?branch=master\r\n :alt: Travis-CI Build Status\r\n :target: https://travis-ci.org/nirs/cthreading\r\n\r\n\r\nPerformance\r\n===========\r\n\r\ncthreading eliminates the overhead of `threading.RLock` and\r\n`threading.Condition` which are implemented in pure Python in Python 2.\r\nIn particular, `threading.Condition` is implemented using polling. In\r\nPython 3 `threading.Condition` is implemented without polling;\r\ncthreading implements a similar design in C.\r\n\r\n.. code-block::\r\n\r\n $ time python whispers.py -m cthreading\r\n real 0m2.664s\r\n user 0m2.965s\r\n sys 0m0.808s\r\n\r\n $ time python3 whispers.py\r\n real 0m9.664s\r\n user 0m8.949s\r\n sys 0m1.812s\r\n\r\n $ time python whispers.py\r\n real 0m14.914s\r\n user 0m16.986s\r\n sys 0m12.690s\r\n\r\n $ time python whispers.py -m pthreading\r\n real 0m20.169s\r\n user 0m23.062s\r\n sys 0m17.022s\r\n\r\nYour application is unlikely to have similar workload; do not expect\r\nthis improvement.\r\n\r\nFor more info see https://github.com/nirs/cthreading/wiki/performance.\r\n\r\n\r\nUsage\r\n=====\r\n\r\nImport cthreading before any other module and monkeypatch the thread and\r\nthreading modules. From this point, threading.Lock, threading.RLock, and\r\nthreading.Condition are using cthreading.\r\n\r\n.. code-block:: python\r\n\r\n import cthreading\r\n cthreading.monkeypatch()\r\n\r\nNote: cthreading will raise RuntimeError if the threading module was\r\nimported before `cthreading.monkeypatch()` is called.\r\n\r\n\r\nTested platforms\r\n================\r\n\r\nx86_64\r\n------\r\n\r\n- Fedora 22 / Python 2.7.10\r\n- RHEL 7.2 / Python 2.7.5\r\n- RHEL 7.2 / Python 2.7.10+ (upstream)\r\n- RHEL 7.1 / Python 2.7.5\r\n- RHEL 6.7 / Python-2.6.6\r\n- Ubuntu 14.04 Server / Python 2.7.6\r\n- Ubuntu 12.04 Server / Python 2.7.3 (python regression tests not available)\r\n- Ubuntu 12.04 / Python 2.6.9 (Travis container)\r\n- Ubuntu 12.04 / Python 2.7.9 (Travis container)\r\n\r\nPOWER8E\r\n-------\r\n\r\n- RHEL 7.2 / Python 2.7.5\r\n- RHEL 7.2 / Python 2.7.10+ (upstream)\r\n\r\n\r\nHacking\r\n=======\r\n\r\nFor rpm based distributions::\r\n\r\n yum install python-devel python-test\r\n\r\nFor deb based distributions::\r\n\r\n apt-get install python-dev libpython2.7-testsuite\r\n\r\nInstalling Python packages::\r\n\r\n pip install pytest pytest-timeout yappi==0.93\r\n\r\nBuilding and running the quick tests::\r\n\r\n make\r\n\r\nBefore submitting patches, run the Python regression tests suite::\r\n\r\n make regrtest\r\n\r\nCheck the `Makefile` for more info.\r\n\r\n\r\nSimilar projects\r\n================\r\n\r\n- `pthreading `_ - uses\r\n pthread_mutex and pthread_cond apis directly via ctypes. This\r\n introduces undefined behavior and actually slower and increases cpu\r\n usage in most cases compared to the original Python implementation.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nirs/cthreading", "keywords": "", "license": "GNU GPLv2+", "maintainer": "", "maintainer_email": "", "name": "cthreading", "package_url": "https://pypi.org/project/cthreading/", "platform": "Linux", "project_url": "https://pypi.org/project/cthreading/", "project_urls": { "Homepage": "https://github.com/nirs/cthreading" }, "release_url": "https://pypi.org/project/cthreading/0.3/", "requires_dist": null, "requires_python": null, "summary": "C implementation of Python 2 threading's Lock, RLock, and Condition", "version": "0.3" }, "last_serial": 2319390, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "74985bbbfbd12075e2e545e6f88a1a69", "sha256": "950abc0f1116cd8cfc9917a48637a79b8da635502868d24126c8ae3f882ff03e" }, "downloads": -1, "filename": "cthreading-0.1.tar.gz", "has_sig": false, "md5_digest": "74985bbbfbd12075e2e545e6f88a1a69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17897, "upload_time": "2015-10-14T08:32:53", "url": "https://files.pythonhosted.org/packages/61/66/3a52af79d57c96a64ac7d7db69fbf8b11d7d449ba4bee28e31274148df8f/cthreading-0.1.tar.gz" }, { "comment_text": "", "digests": { "md5": "876d4bbe9e842bd93a4e816c341e85aa", "sha256": "2651f506ac15c8d937c68635beaec4e551264ff5790f7ec3d1b7593e0014a6be" }, "downloads": -1, "filename": "cthreading-0.2.tar.gz", "has_sig": false, "md5_digest": "876d4bbe9e842bd93a4e816c341e85aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18234, "upload_time": "2015-10-16T18:03:13", "url": "https://files.pythonhosted.org/packages/ed/16/70f6df9030b5bf0b6bf4b569d0f34b3f23b700883f6cbd53dfb89dc9f3c1/cthreading-0.2.tar.gz" } ], "0.2": [], "0.3": [ { "comment_text": "", "digests": { "md5": "923a9a9cad12baa0e794dd86447833e1", "sha256": "37fabab25a02848d59f1a1dfee5bd97d3943534b5a966750572859dd7ea5432f" }, "downloads": -1, "filename": "cthreading-0.3.tar.gz", "has_sig": false, "md5_digest": "923a9a9cad12baa0e794dd86447833e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18742, "upload_time": "2015-11-02T22:17:43", "url": "https://files.pythonhosted.org/packages/40/1d/95a62ac94770eda970494fd2f28ebada34a24a0698ee0d0bd832a3d20eb3/cthreading-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "923a9a9cad12baa0e794dd86447833e1", "sha256": "37fabab25a02848d59f1a1dfee5bd97d3943534b5a966750572859dd7ea5432f" }, "downloads": -1, "filename": "cthreading-0.3.tar.gz", "has_sig": false, "md5_digest": "923a9a9cad12baa0e794dd86447833e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18742, "upload_time": "2015-11-02T22:17:43", "url": "https://files.pythonhosted.org/packages/40/1d/95a62ac94770eda970494fd2f28ebada34a24a0698ee0d0bd832a3d20eb3/cthreading-0.3.tar.gz" } ] }