{ "info": { "author": "Johan Nestaas", "author_email": "johannestaas@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Environment :: MacOS X", "Environment :: Win32 (MS Windows)", "Environment :: X11 Applications :: Qt", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python" ], "description": "monkeytime\n==========\n\nPatch datetime to use a much quicker strptime implementation.\n\nThis **ONLY** improves strptime when the format string uses padded directives.\n\nThis is the list of supported directives (by far the most common)::\n\n SUPPORTED_DIRECTIVES = ('%d', '%m', '%Y', '%H', '%M', '%S', '%f')\n\nCheck if your date/time format is supported by calling::\n \n datetime.supported_strptime(format_string)\n # True if supported, False otherwise\n\nOn average, 4 times quicker than the stdlib version, and 40 times quicker\nwhen using pypy!\n\nUsage::\n\n # insert this one line\n from monkeytime import datetime\n # Done migrating code to monkeytime!\n\n from datetime import datetime\n\n # Call it once with the specific format string\n # It will build a new function to quickly parse the string, then run it on\n # the string you passed it.\n dt = datetime.strptime('2014-05-30T12:14:15.123456', '%Y-%m-%dT%H:%M:%S.%f')\n \n # Now, whenever you use that format again, it will use the function it \n # built already! All constructed functions are memoized.\n # Since we usually only use one or two formats in our code to parse logs\n # and such, the performance of constructing it is negligible.\n\nAll you need is that one line \"from monkeytime import datetime\", and your\nstrptime performance will increase dramatically. \n\n**Make sure it is ABOVE your \"from datetime import datetime\" import line!**\n\nPerformance example::\n\n $ python timeit_test.py \n Testing builtin strptime\n testing ('2015-01-02 03:04:05.001234', '%Y-%m-%d %H:%M:%S.%f')\n 6.80288290977 seconds\n testing ('05-06 12:15:18', '%m-%d %H:%M:%S')\n 5.81049013138 seconds\n testing ('2010', '%Y')\n 4.29107117653 seconds\n testing ('1905/08/05', '%Y/%m/%d')\n 4.92634987831 seconds\n testing ('14:05:03.123456', '%H:%M:%S.%f')\n 5.6812889576 seconds\n Testing monkeytime strptime\n testing ('2015-01-02 03:04:05.001234', '%Y-%m-%d %H:%M:%S.%f')\n 1.83126211166 seconds\n testing ('05-06 12:15:18', '%m-%d %H:%M:%S')\n 1.5586848259 seconds\n testing ('2010', '%Y')\n 0.877351999283 seconds\n testing ('1905/08/05', '%Y/%m/%d')\n 1.24154901505 seconds\n testing ('14:05:03.123456', '%H:%M:%S.%f')\n 1.3871409893 seconds\n 3.714860 times as fast\n 3.727816 times as fast\n 4.890935 times as fast\n 3.967906 times as fast\n 4.095682 times as fast\n Average: 4.079440 times as fast\n\n $ pypy timeit_test.py \n Testing builtin strptime\n testing ('2015-01-02 03:04:05.001234', '%Y-%m-%d %H:%M:%S.%f')\n 2.19319605827 seconds\n testing ('05-06 12:15:18', '%m-%d %H:%M:%S')\n 1.60669994354 seconds\n testing ('2010', '%Y')\n 0.858637809753 seconds\n testing ('1905/08/05', '%Y/%m/%d')\n 1.19449591637 seconds\n testing ('14:05:03.123456', '%H:%M:%S.%f')\n 1.38721394539 seconds\n Testing monkeytime strptime\n testing ('2015-01-02 03:04:05.001234', '%Y-%m-%d %H:%M:%S.%f')\n 0.0362730026245 seconds\n testing ('05-06 12:15:18', '%m-%d %H:%M:%S')\n 0.0450730323792 seconds\n testing ('2010', '%Y')\n 0.0332229137421 seconds\n testing ('1905/08/05', '%Y/%m/%d')\n 0.0321681499481 seconds\n testing ('14:05:03.123456', '%H:%M:%S.%f')\n 0.0355319976807 seconds\n 60.463593 times as fast\n 35.646591 times as fast\n 25.844747 times as fast\n 37.132876 times as fast\n 39.041260 times as fast\n Average: 39.625813 times as fast", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.bitbucket.org/johannestaas/monkeytime", "keywords": "datetime time parsing", "license": "GPLv3+", "maintainer": "", "maintainer_email": "", "name": "monkeytime", "package_url": "https://pypi.org/project/monkeytime/", "platform": "", "project_url": "https://pypi.org/project/monkeytime/", "project_urls": { "Homepage": "https://www.bitbucket.org/johannestaas/monkeytime" }, "release_url": "https://pypi.org/project/monkeytime/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Patch datetime for functions and increased performance of strptime", "version": "0.2.1" }, "last_serial": 4087989, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "27051a55c3f697fd806588398859aec4", "sha256": "da5b5c8d8346933a3781eda981c0b68e899c2500d8c5349d6e9f2c40ee36c8ab" }, "downloads": -1, "filename": "monkeytime-0.1.2.tar.gz", "has_sig": false, "md5_digest": "27051a55c3f697fd806588398859aec4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3716, "upload_time": "2015-01-08T08:35:46", "url": "https://files.pythonhosted.org/packages/eb/c0/ee11b7434b703aa5d0d7fc13e2049237e6fcd52e5a32bd590e080bae94b9/monkeytime-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "c56d8373806251de60a30973a0a67132", "sha256": "5fadb5e674b9af9372cbfc575e86d3ec4e5eb8c7de89dc30c287cf5a58647ea3" }, "downloads": -1, "filename": "monkeytime-0.2.0.tar.gz", "has_sig": false, "md5_digest": "c56d8373806251de60a30973a0a67132", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4444, "upload_time": "2015-01-08T08:39:15", "url": "https://files.pythonhosted.org/packages/6c/c3/023119641835753f8652477cd653a94d9ffccd5a9de7a187f3b055e09cb6/monkeytime-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "2f26f687ff606ec75ea0590751fa2627", "sha256": "4d7687eb4e24ccabec5c7f3504039a1deee3d6f0b3629559e337c20325aaa534" }, "downloads": -1, "filename": "monkeytime-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2f26f687ff606ec75ea0590751fa2627", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4439, "upload_time": "2018-07-21T07:55:37", "url": "https://files.pythonhosted.org/packages/b7/82/0937cee1f541597953915d478eb59e8ad5a26ad7de1a5b11e772724a65a5/monkeytime-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2f26f687ff606ec75ea0590751fa2627", "sha256": "4d7687eb4e24ccabec5c7f3504039a1deee3d6f0b3629559e337c20325aaa534" }, "downloads": -1, "filename": "monkeytime-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2f26f687ff606ec75ea0590751fa2627", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4439, "upload_time": "2018-07-21T07:55:37", "url": "https://files.pythonhosted.org/packages/b7/82/0937cee1f541597953915d478eb59e8ad5a26ad7de1a5b11e772724a65a5/monkeytime-0.2.1.tar.gz" } ] }