Python速度问题和意见 [英] Python Speed Question and Opinion

查看:75
本文介绍了Python速度问题和意见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个相当新的编程但不是这样我是一个初学者


据我所知,C和C ++是比Python更快的语言。这是因为Pythons几乎可以在任何操作系统上运行吗?或者

还有很多其他原因吗?

我明白有ansi / iso C和C ++,ANSI / ISO代码可以使用

任何系统


如果这就是为什么,为什么不开发人员为那里的操作系统创建特定的Python

Distrubutions。


请不要采取错误的方式我完全符合标准。我只是在看这些论坛,而且有很多关于Python的东西,它有很多关于C或C ++的b $ b


另外根据我的理解,有解释和编译的语言

带解释语言的内存在运行时使用和编译语言

程序存储在内存中。


或者这是错的?


Python是一种解释语言,对吗?不可能

如果有特定于操作系统的Python distrubutions,你可以使Python成为一个

编译语言


或者这完全错了吗?


谢谢你回答我的问题


再见现在

Hi I am fairly new to programming but not as such that I am a total beginner

From what I understand C and C++ are faster languages than Python. Is this
because of Pythons ability to operate on almost any operating system? Or is
there many other reasons why?
I understand there is ansi/iso C and C++ and that ANSI/ISO Code will work on
any system

If this is the reason why, than why don''t developers create specific Python
Distrubutions for there operating system.

Please don''t take this the wrong way I am totally one for standards. I am
just looking at these forums and there is a lot of stuff about Python and it
inability to match C or C++

Also from what I understand there are Interpreted and Compiled languages
with Interpreted languages memory is used at runtime and Compiled languages
the program is stored in memory.

Or is this wrong?

Python is an Interpreted Language, am I right? than wouldn''t it be possible
if there was OS specific Python distrubutions, that you could make Python a
Compiled language

Or is this completely wrong?

Thanks if you answer my questions

Bye For Now

推荐答案

Maboroshi写道:
Maboroshi wrote:
嗨我是一个相当新的编程但不是这样我是一个初学者


总的来说,初学者有时候并没有意识到像你这样的问题曾经多次被问过多次。搜索Google

群组( http://groups.google.com )对于这个新闻组中的讨论

将节省你自己和其他人很多时间再次重新论证所有

。 (并且它确实成为一个争论,在

初始事实响应之后。:-)

据我所知,C和C ++是比Python更快的语言。这是因为Pythons几乎可以在任何操作系统上运行吗?


没错,它们通常更快,但并非总是如此。原因很简单,就是Python(至少是Python的C实现)是一种解释的b / b $ b语言,而C / C ++则被编译为本机机器代码。 />
请不要采取错误的方式我完全符合标准。我只是看着这些论坛,有很多关于Python的东西,它无法匹配C或C ++


有些人不适当地沉迷于速度并认为只是因为C可以为某些类型的问题提供更好的性能,因此它必须是一个更好的语言用于所有目的。其他人

认为*开发*的速度更重要,并且选择

Python,即使对于速度较慢的应用程序也是如此。通常情况下,令人惊讶的是,他们发现它可以以相当可接受的速度运行,而且在某些情况下,b $ b甚至比从C获得的速度更快。

类似的投入开发时间。

另外根据我的理解,有解释和编译语言
解释语言内存在运行时使用和编译语言
程序存储在内存中。

或者这是错的?
Hi I am fairly new to programming but not as such that I am a total beginner
Total beginners sometimes don''t realize that questions such as yours
have been asked repeatedly, many times, in the past. Searching Google
Groups (http://groups.google.com) for such discussions in this newsgroup
will save yourself and others much time rehashing the argument all
over again. (And it does generally become an argument, after the
initial factual responses. :-)
From what I understand C and C++ are faster languages than Python. Is this
because of Pythons ability to operate on almost any operating system?
True, they are often faster, but not always. The reason is simply that
Python (at least, the C implementation of Python) is an interpreted
language, whereas C/C++ are compiled to native machine code.
Please don''t take this the wrong way I am totally one for standards. I am
just looking at these forums and there is a lot of stuff about Python and it
inability to match C or C++
Some people are inappropriately obsessed with speed and think that just
because C can provide better performance for certain types of problem,
it must therefore be a better language for all purposes. Other people
think that speed of *development* is far more important, and choose
Python even for those applications where it is slower. Often, perhaps
surprisingly, they find it can run at quite acceptable speeds, and
in some cases even faster than what they could get from C with a
similar amount of development time invested.
Also from what I understand there are Interpreted and Compiled languages
with Interpreted languages memory is used at runtime and Compiled languages
the program is stored in memory.

Or is this wrong?




我不能说它是不是因为它错了非常迷糊......不会对我有任何意义。对于这两种类型的语言,该程序是存储在存储器中的b $ b。并且两种类型都在运行时使用内存。


不要担心性能和解释与编译。

尝试使用Python,将它用于更多如果你喜欢它,还有更多东西,更少

的东西,或者根本没有,如果你不是,并专注于写好的

质量代码,而不是最快的代码你可以写...


-Peter



I can''t say if it''s wrong because it''s very befuddled.... doesn''t
mean anything to me. With both types of languages the program is
"stored in memory" and with both types "memory is used at runtime".

Stop worrying about performance and interpreted vs. compiled.
Try Python, use it for more and more stuff if you like it, less
stuff or nothing at all if you don''t, and focus on writing good
quality code, not the fastest code you can write...

-Peter


2004年6月4日星期五17:14:44 -0700,Maboroshi写道:
On Fri, 04 Jun 2004 17:14:44 -0700, Maboroshi wrote:
你好,我是一个相当新的编程但不是这样我是一个初学者

据我所知,C和C ++是比Python更快的语言。这是因为Pythons几乎可以在任何操作系统上运行吗?或者还有很多其他原因吗?
我知道有ansi / iso C和C ++以及ANSI / ISO Code可以在任何系统上运行

如果这就是为什么不开发人员为那里的操作系统创建特定的Python
Distrubutions的原因。
请不要采取错误的方式我完全符合标准。我只是看着这些论坛,有很多关于Python的东西,它无法匹配C或C ++

另外,据我所知,有解释和编译语言
带解释语言内存在运行时使用和编译语言程序存储在内存中。

或者这是错误的吗?

Python是解释性语言,对吗?不可能
如果有特定于操作系统的Python distrubutions,你可以使Python成为一种编译语言

或者这是完全错误的吗?

谢谢你回答我的问题

Bye For Now
Hi I am fairly new to programming but not as such that I am a total beginner

From what I understand C and C++ are faster languages than Python. Is this
because of Pythons ability to operate on almost any operating system? Or is
there many other reasons why?
I understand there is ansi/iso C and C++ and that ANSI/ISO Code will work on
any system

If this is the reason why, than why don''t developers create specific Python
Distrubutions for there operating system.

Please don''t take this the wrong way I am totally one for standards. I am
just looking at these forums and there is a lot of stuff about Python and it
inability to match C or C++

Also from what I understand there are Interpreted and Compiled languages
with Interpreted languages memory is used at runtime and Compiled languages
the program is stored in memory.

Or is this wrong?

Python is an Interpreted Language, am I right? than wouldn''t it be possible
if there was OS specific Python distrubutions, that you could make Python a
Compiled language

Or is this completely wrong?

Thanks if you answer my questions

Bye For Now




一般来说,你会发现C和C ++是最快的语言。

C / C ++的实现通常比其他任何东西都要快得多

(无论是Python,Java,Perl等)我都不认为速度

差异是因为便携性。 Python被解释,但不完全是
。它以某种方式处理编译后的字节代码*大致*类似于

Java。


就个人而言,我认为人们常常因速度而变形没有

很好的理由。我不是说速度无关紧要,这非常重要。

有些情况。但人们会抛弃一种语言,因为它会在0.005秒内执行基准测试,而C则可以在0.00002

秒内执行。对我来说这是愚蠢的。你需要在所有类别中评估一种语言

的实现,而不仅仅是基于标准的运行时速度


场景A:一个人选择以纯粹的方式完成一个项目C因为C更快。

然而,他们对C没有很好的理解,因此他们的

算法实现很草率。


场景B:一个人为项目选择了Python。他们意识到Python的实现可能比C实现慢,但由于他们的

算法实现在高级语言中更清晰,所以他们

最终有一个更容易的时间进行优化,实际上最终获得了更好的性能结果。


虽然速度很重要而且C实现通常会更快,我们

需要记住还有许多其他因素需要考虑。在我的意见中,程序员的工作效率和实现的简单性通常比原始运行时性能更有价值。我认为没有多少语言可以与Python相媲美。

程序员的工作效率和简单性。


-

Mark J. Nenadov

Python Byte Solutions
http://www.pythonbyte.com



Generally speaking, you will find C and C++ to be the fastest languages.
Implementations of C/C++ are generally much faster than anything else
(whether it be Python, Java, Perl, etc.) I don''t think the speed
difference is because of portability. Python is interpreted, but not
completely. It deals with compiled byte-code in a way *roughly* similar to
Java.

Personally, I think people often get bent out of shape about speed for no
good reason. I''m not saying speed does not matter, it matters very much in
SOME situations. But people will discard a language just because it
performs a benchmark in 0.005 seconds, whereas C can do it in 0.00002
seconds. To me that is unintelligent. You need to evaluate a language
implementation in all categories, not just bench-marked runtime speed

Scenario A: A person chose to do a project in pure C because C is faster.
However, they didn''t have a good understand of C, and as a result their
algorithm implementations were sloppy.

Scenario B: A person chose Python for a project. They realized the Python
implementation may be slower than the C implementation, but since their
algorithm implementations were much clearer in a high-level language, they
ended up having an easier time optimizing and actually ended up with
better performance results.

While speed is important and C implementations will usually be faster, we
need to remember that there are many other factors to consider. In my
opinion, things like programmer productivity and simplicity of
implementation are usually more valuable than raw runtime performance. I
think that there are not many languages that can match Python in terms of
programmer productivity and simplicity.

--
Mark J. Nenadov
Python Byte Solutions
http://www.pythonbyte.com


Hello Peter Hansen


总的初学者有时候并没有意识到像你这样的问题
Hello Peter Hansen

Total beginners sometimes don''t realize that questions such as yours
过去曾经多次被问过。搜索Google
论坛( http://groups.google.com )这个新闻组中的讨论将会让你自己和其他人多花时间重新讨论所有的论点。 (并且它确实成为一个争论,在
最初的事实回答之后。:-)

对不起我有一个不习惯不搜索谷歌的坏习惯我将不得不

记得在我的下一篇文章之前这样做

尝试使用Python,如果你喜欢它,可以使用它来获得越来越多的东西,如果你不喜欢的话,可以使用它或者什么都不做,并专注于编写好的质量代码,而不是你能写的最快的代码...

在我看来,Python是最好的语言,我喜欢它。我问这些问题的原因是因为我看到很多人试图将python与C进行比较,而我必须找出最重要的是什么? />
以及为什么C将是一种更快的语言 - 我想知道事情是如何运作的 -

不要担心性能和解释与编译。
have been asked repeatedly, many times, in the past. Searching Google
Groups (http://groups.google.com) for such discussions in this newsgroup
will save yourself and others much time rehashing the argument all
over again. (And it does generally become an argument, after the
initial factual responses. :-)
Sorry I have a bad habit of not searching google first I will have to
remember to do that before my next post
Try Python, use it for more and more stuff if you like it, less
stuff or nothing at all if you don''t, and focus on writing good
quality code, not the fastest code you can write...
In my opinion Python is the best language there is and I love it. The
reason for me asking these questions was because I saw a lot of people
trying to compare python to C and I had to find out what the big deal was
and why C would be a faster language - I like to know how things work -
Stop worrying about performance and interpreted vs. compiled.




我将definitley对此提出建议 - 但说实话我从来没有

真正关心或担心速度 - 我只是喜欢python



I will definitley take your advice on this - But to be honest I was never
really concerned or worried about speed - I just love python


这篇关于Python速度问题和意见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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