{ "info": { "author": "Ryan Kelly", "author_email": "ryan@rfk.id.au", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2" ], "description": "atinline: forcibly inline python functions to their call site\n==============================================================\n\n\nThis is a Python hack to let you specify functions as \"inline\" in much the\nsame way you'd do in C. You save the cost of a function call by inlining\nthe code of the function right at the call site. Of course, being Python,\nthe inlining is done at runtime.\n\nWARNING: Don't use this in any real code. Seriously. It's just a fun hack.\n\nNow then, suppose you have some code like this::\n\n def calculate(x):\n return 3*x*x - 2*x + (1/x)\n\n def aggregate(items):\n total = 0\n for item in items:\n total += calculate(item)\n return total\n\nThis code pays the overhead of a function call for every item in the collection.\nYou can get substantial speedups by inlining the calculate function like so::\n\n def aggregate(items):\n total = 0\n for x in items:\n total += 3*x*x - 2*x + (1/x)\n return total\n\nBut now you're paying the costs in terms of code quality and re-use. To get\nthe best of both worlds simply declare that the calculate function should be\ninlined::\n\n from atinline import inline\n\n @inline\n def calculate(x):\n return 3*x*x - 2*x + (1/x)\n\n def aggregate(items):\n total = 0\n for item in items:\n total += calculate(item)\n return total\n\nNow the first time the aggregate() function runs, it will detect that the\ncalculate() function should be inlined, make the necessary bytecode hacks\nto do so, then continue on its way. Any subsequent calls to aggregate()\nwill avoid the overhead of many function calls.\n\nCurrently only plain calls of top-level functions are supported; things won't\nwork correctly if you try to inline methods, functions looked up in a dict,\nor other stuff like this. It also doesn't work with keyword arguments.\nThese limitations might go away in future.\n\nThe heavy-lifting of bytecode regeneration is done by the fantastic \"byteplay\"\nmodule, which is atinline's only dependency.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/rfk/atinline", "keywords": "bytecode hack inline", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "atinline", "package_url": "https://pypi.org/project/atinline/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/atinline/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/rfk/atinline" }, "release_url": "https://pypi.org/project/atinline/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "forcibly inline python functions to their call site", "version": "0.1.1" }, "last_serial": 786543, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5f526e901108fe6f4ae20575c1d3011a", "sha256": "5477bfcf1becae424e22cd9a4e5053fd8d1ce3d33b228eddfa529c0d27b323b2" }, "downloads": -1, "filename": "atinline-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5f526e901108fe6f4ae20575c1d3011a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6101, "upload_time": "2011-04-13T01:38:49", "url": "https://files.pythonhosted.org/packages/ad/24/d385312b4a0447529e32eeb4ee12e0db4915dd3a919080dca9a972798a1c/atinline-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2dd54cdd363cb775c86e247f62bee26e", "sha256": "010e0d7af800fe60df415c073b78e791f8a5f5c51caa0050c787eb3c244a7f58" }, "downloads": -1, "filename": "atinline-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2dd54cdd363cb775c86e247f62bee26e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6982, "upload_time": "2011-04-16T01:23:14", "url": "https://files.pythonhosted.org/packages/2f/1c/ecebff119675b6d08cd676e433d52e414c93e82db775fcf014d99aa5bec4/atinline-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2dd54cdd363cb775c86e247f62bee26e", "sha256": "010e0d7af800fe60df415c073b78e791f8a5f5c51caa0050c787eb3c244a7f58" }, "downloads": -1, "filename": "atinline-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2dd54cdd363cb775c86e247f62bee26e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6982, "upload_time": "2011-04-16T01:23:14", "url": "https://files.pythonhosted.org/packages/2f/1c/ecebff119675b6d08cd676e433d52e414c93e82db775fcf014d99aa5bec4/atinline-0.1.1.tar.gz" } ] }