python代码优化器。

pycc的Python项目详细描述


https://travis-ci.org/kevinconway/pycc.svg?branch=master

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.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在可序列化接口下重写readObject()和writeObject()方法在实际开发中的应用如何?   java JAXWS在显式添加SOAPAction头后发送空值   拆分从文件中读取的字符串时发生java ArrayIndexOutOfBoundsException   java使用Fabric远程启动Tomcat   这可以用Java实现吗?   java从AccoutHeaderBuilder()中定义的ProfileSettingDrawerItem()打开活动   java我需要我的SpringBootWebApplication在JUnit中重新启动   java通过蓝牙将数据从手机发送到笔记本电脑   java HttpServletRequest:如何确定所请求资产的ContentType   使用WMQ代码(非JMS)实现IBM MQ侦听器的java   使用java执行后台进程静默模式。exe   java如何从stringarray列表中随机选择   HackerAth上的java NZEC错误   java如何修复错误502状态   java JPanel GridLayout(部分由循环填充)将新值添加到end,而不考虑它们的添加顺序   java BigInteger循环和逻辑未按计划工作