Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How fast is Python? [closed]

I'm a Java programmer and if there's one thing that I dislike about it, it would be speed. Java seems really slow, but a lot of the Python scriptsprograms I have written so far seem really fast.

So I was just wondering if Python is faster than Java, or C# and how that compares to C/C++ (which I figure it'll be slower than)?

like image 474
Bob Dylan Avatar asked Nov 06 '09 08:11

Bob Dylan


People also ask

How fast is a Python?

Pythons can't move very fast though—only about 1 mile per hour (1.6 kilometers per hour) on open ground. But since they don't have to chase their food, they don't really need to move quickly.

How many times faster is C++ than Python?

Depending on the complexity of calculations, C++ is anywhere from 10 to 100 times faster than Python. Python programs also tend to use more RAM than applications built with C++. However, many programmers acknowledge that the simple syntax of Python makes it a much faster language for development.

Which is faster C++ or Python?

C++ is faster than Python because it is statically typed, which leads to a faster compilation of code. Python is slower than C++, it supports dynamic typing, and it also uses the interpreter, which makes the process of compilation slower.

Is Python ever faster than C?

C is a faster language compared to Python as it is compiled. Python programs are usually slower than C programs as they are interpreted. In C, the type of the various variables must be declared when they are created, and only values of those particular types must be assigned to them.


1 Answers

In terms of raw performance, Python is definitely slower than Java, C# and C/C++. However, there are other things that matter for the user/observer such as total memory usage, initial startup time, etc. For most things, Python is fast enough ;)

This site lets you compare different programming languages to each other. It uses simple bar graphs to show speed, memory usage, etc.

If you're interested, you can take a look at the much anticipated Unladen Swallow project that's striving to improve the performance of Python to five times that of CPython (!)

like image 186
lemonad Avatar answered Oct 11 '22 03:10

lemonad