是一个“真实的” C-Python可能吗? [英] Is a "real" C-Python possible?

查看:72
本文介绍了是一个“真实的” C-Python可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我理解标准的Python发行版被认为是C-Python的
。 Howerver,目前的C-Python实际上是C和Python实现的组合。 Windows版本的Python发行版中包含大约2000个Python文件

。我不确定

在C中实现了多少C-Python,但我认为在C中实现的模块越多,性能越好,内存越低<它将获得
足迹。


我想知道是否有可能完全(或在
$ b)使用Python就像在PHP中实现的一样,大多数情况下是$ b,就像PHP一样 - 我认为

这就是PHP获得性能优势的地方。或许我错了

,因为重要的核心模块已经在C和那些Python

文件中真的是一个思考包装器。无论如何,如果Python

具有类似于Java的性能,两者都是解释语言,那将是理想的。


Jack

解决方案

文章< G6 ****************************** @ comcast。 com>,

杰克< no **** @ invalid.comwrote:


>
我明白标准的Python发行版被认为是C-Python。 Howerver,当前的C-Python实际上是C和Python实现的组合。 Windows版本的Python发行版中包含大约2000个Python文件。我不确定在C中实现了多少C-Python,但我认为在C中实现的模块越多,性能越好,内存占用越少。



证明它。 ;-)


严重的是,切换到更多的C代码会导致开发陷入困境,因为Python比C语言更容易编写。


>我想知道是否有可能在C中实现完全(或大部分)的Python,只是像PHP一样 - 我认为这就是PHP获得性能优势的地方。或许我错了
因为重要的核心模块已经在C中,那些Python
文件实际上是一个思考包装器。无论如何,如果Python具有类似于Java的性能,那么它们将是理想的,两者都是解释型语言。



你能否提供一些证据表明Python比Java或PHP慢?

-

Aahz( aa**@pythoncraft.com)< * http://www.pythoncraft.com/


打字很便宜。思考很昂贵。 --Roy Smith


Jack schrieb:


我明白标准的Python发行版被视为

C-Python。 Howerver,目前的C-Python实际上是C和Python实现的组合。 Windows版本的Python发行版中包含大约2000个Python文件

。我不确定

在C中实现了多少C-Python,但我认为在C中实现的模块越多,性能越好,内存越低<它将获得
足迹。


我想知道是否有可能完全(或在
$ b)使用Python就像在PHP中实现的一样,大多数情况下是$ b,就像PHP一样 - 我认为

这就是PHP获得性能优势的地方。或许我错了

,因为重要的核心模块已经在C和那些Python

文件中真的是一个思考包装器。无论如何,如果Python

具有与Java类似的性能,两者都是解释语言,那将是理想的。



用C编写所有内容可能是可能的 - 但这是一项艰巨的任务。不是

结果合理。无论标准库在何处使用,都可以使用Python的灵活性,但是,如果确实有任何

的性能提升,那将是值得怀疑的。


但真正值得怀疑的是所谓的性能优势 -

你如何支持它?根据众所周知的(肯定是有限的)计算机语言枪战

http://shootout.alioth.debian.org/gp...t=all&lang=all

Python比PHP快大约25%。当然,这只是一个

基准,与现实生活相关性有问题。但是你从哪里得到

那个PHP的印象比Python更快?


diez


< blockquote>


>我不确定在C中实现了多少C-Python,但我认为更多用C语言实现的模块,它将获得更好的性能和更低的内存占用空间。



证明一下。 ;-)



我想这是主观的:) - 这就是我的经验感觉

开发的Web应用程序Python和PHP。我无法在网上找到直接的比较。


说真的,切换到更多的C代码会导致开发陷入困境

因为Python比C更容易编写。



我明白。用Python实现的Python模块 - 这就是如何使用Python获得真正丰富的库。


> >我想知道是否有可能在C中实现完全(或者在大多数情况下最少)的Python,就像PHP一样 - 我认为
这就是PHP的地方获得其性能优势。或许我错了
因为重要的核心模块已经在C和那些Python
文件中真的是一个很薄的包装器。无论如何,如果Python具有与Java类似的性能,两者都是解释型语言,那将是理想的选择。



你能否提供一些证据表明Python比Java或PHP慢?



我认为你可以在网上找到的大多数Java-Python基准测试表明,Java的速度要快3到10倍。一些在这里:
http: //mail.python.org/pipermail/pyt...ry/125789.html
http://blog.snaplogic.org/?p=55


这是一篇显示新版本的文章在某些方面,Ruby比Python快了
(他们正在追赶:)
http://antoniocangiano.com/2007/11/2...s-python-away/

I understand that the standard Python distribution is considered
the C-Python. Howerver, the current C-Python is really a combination
of C and Python implementation. There are about 2000 Python files
included in the Windows version of Python distribution. I''m not sure
how much of the C-Python is implemented in C but I think the more
modules implemented in C, the better performance and lower memory
footprint it will get.

I wonder if it''s possible to have a Python that''s completely (or at
least for the most part) implemented in C, just like PHP - I think
this is where PHP gets its performance advantage. Or maybe I''m wrong
because the core modules that matter are already in C and those Python
files are really a think wrapper. Anyhow, if would be ideal if Python
has performance similar to Java, with both being interpreted languages.

Jack

解决方案

In article <G6******************************@comcast.com>,
Jack <no****@invalid.comwrote:

>
I understand that the standard Python distribution is considered
the C-Python. Howerver, the current C-Python is really a combination
of C and Python implementation. There are about 2000 Python files
included in the Windows version of Python distribution. I''m not sure
how much of the C-Python is implemented in C but I think the more
modules implemented in C, the better performance and lower memory
footprint it will get.

Prove it. ;-)

Seriously, switching to more C code will cause development to bog down
because Python is so much easier to write than C.

>I wonder if it''s possible to have a Python that''s completely (or at
least for the most part) implemented in C, just like PHP - I think
this is where PHP gets its performance advantage. Or maybe I''m wrong
because the core modules that matter are already in C and those Python
files are really a think wrapper. Anyhow, if would be ideal if Python
has performance similar to Java, with both being interpreted languages.

Could you provide some evidence that Python is slower than Java or PHP?
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/

"Typing is cheap. Thinking is expensive." --Roy Smith


Jack schrieb:

I understand that the standard Python distribution is considered
the C-Python. Howerver, the current C-Python is really a combination
of C and Python implementation. There are about 2000 Python files
included in the Windows version of Python distribution. I''m not sure
how much of the C-Python is implemented in C but I think the more
modules implemented in C, the better performance and lower memory
footprint it will get.

I wonder if it''s possible to have a Python that''s completely (or at
least for the most part) implemented in C, just like PHP - I think
this is where PHP gets its performance advantage. Or maybe I''m wrong
because the core modules that matter are already in C and those Python
files are really a think wrapper. Anyhow, if would be ideal if Python
has performance similar to Java, with both being interpreted languages.

Writing everything in C might be possible - but is a daunting task & not
justified by the results. And wherever the standard libraries make use
of the flexibility of Python, it''s questionable if there really was any
performance gain at all.

But what REALLY is questionable is the alleged performance advantage -
how do you back that up? According to the well-known (and surely
limited) computer language shootout

http://shootout.alioth.debian.org/gp...t=all&lang=all
Python is roughly 25% faster than PHP. Granted, this is just one
benchmark, with questionable real-life relevance. But where do you get
the impression from that PHP is faster than Python then?

diez


>I''m not sure
how much of the C-Python is implemented in C but I think the more
modules implemented in C, the better performance and lower memory
footprint it will get.


Prove it. ;-)

I guess this is subjective :) - that''s what I felt in my experience
with web applications developed in Python and PHP. I wasn''t able to
find a direct comparison online.

Seriously, switching to more C code will cause development to bog down
because Python is so much easier to write than C.

I understand. Python modules implemented in Python - this is how
Python gets its really rich library.

>>I wonder if it''s possible to have a Python that''s completely (or at
least for the most part) implemented in C, just like PHP - I think
this is where PHP gets its performance advantage. Or maybe I''m wrong
because the core modules that matter are already in C and those Python
files are really a thin wrapper. Anyhow, it would be ideal if Python
has performance similar to Java, with both being interpreted languages.


Could you provide some evidence that Python is slower than Java or PHP?

I think most Java-Python benchmarks you can find online will indicate
that Java is a 3-10 times faster. A few here:
http://mail.python.org/pipermail/pyt...ry/125789.html
http://blog.snaplogic.org/?p=55

Here''s an article that shows the new version of Ruby is
faster than Python in some aspects (they are catching up :)
http://antoniocangiano.com/2007/11/2...s-python-away/


这篇关于是一个“真实的” C-Python可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆