python代码优化器。
pycc的Python项目详细描述
pycc是一个python代码优化器。它重写你的代码,使之更快。
开发者和使用文档<;http://pycc.readthedocs.org/en/latest/>;。
基本示例
符号表(变量)查找一开始似乎并不昂贵。
# awesome_module.pyMAGIC_NUMBER=7forxinxrange(10000000):MAGIC_NUMBER*MAGIC_NUMBER
现在让我们做一个粗略的基准。
# Generate bytecode file to skip compilation at runtime. python -m compileall awesome_module.py # Now get a simple timer. time python awesome_module.pyc # real 0m0.923s # user 0m0.920s # sys 0m0.004s
PYCC对此有何评论?
pycc-transform awesome_module.py --constants
MAGIC_NUMBER=7forxinxrange(10000000):(7*7)
很好,但那有什么用呢?
pycc-compile awesome_module.py -- constants time python awesome_module.pyc # real 0m0.473s # user 0m0.469s # sys 0m0.004s
如何获得它
pip install pycc
许可证
Copyright 2014 Kevin Conway Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
贡献
本项目的所有捐款均受以下协议的保护: 贡献文件。所有贡献者都应该阅读协议,但是 摘要:
You give us the rights to maintain and distribute your code and we promise to maintain an open source distribution of anything you contribute.