473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

python speed

Hi
are there any future perspectives for Python to be as fast as java? i
would like to use Python as a language for writing games.

best regards
krystian
Nov 30 '05
53 3361
On Thu, 29 Dec 2005 00:41:58 +0100, Andreas Kostyrka <an*****@kostyrka.org> wrote:

[on research supposedly proving that Python is faster than C, Java and
Fortran and assembly]
Well, it's easy enough to "prove".

Take one aspect of Python: Automatic memory management via reference
counting.

Now, while it's certainly possible to implement exactly what Python does
in C++ (both are turing complete, ...), the normal and idiomatic way is
to have APIs that care about object ownership.
Your discussion is interesting but a bit misleading, because most function
calls in C++ don't involve ownership issues. Most parameters are passed by
value (for reasonably small things, copying on a warm stack is bloody fast!)
or by const reference, with the understanding that the callee doesn't steal
or borrow a reference to the object. Or, the whole thing is inlined.

Yes, it sometimes happens that you have to have weirder things happen to
your objects -- but only to a tiny fraction of them, not all of them as in
Python. I cannot see how that would make Python, in general, faster than
C++.
The normal idiomatic way
is relevant, as third-party libraries usually force one to develop this
way.


I never use third-party C++ libraries, but I can see how an overly complex,
obsolete and badly designed API (MFC, anone? Or CORBA monstrosities.) could
complicate this a lot. /This/ is an area where C++ and similar languages
lose to Python -- you have to be an expert to write reusable C++ APIs which
don't suck!

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!
Jan 7 '06 #51
It seems that Java JDK 1.4 (-server) HotSpot compiler sometimes (in
this test, on this computer, etc.) can produce programs faster than C
and Fortran ones in n-body simulations and similar stuff:

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

So maybe PyPy can become quite fast too.

Bye,
bearophile

Jan 7 '06 #52
Quite honestly I've never heard of java being faster than.. well..
anything. Faster than Python? I really doubt it. Their are several
libraries for game programming specifically as well as opengl, sdl, as
well as several different audio systems/daemons.. I'd suggest browsing
through the categories in python.org's module search engine.

Disclaimer (:P): The majority of generalizations have some amount of
exceptions, the java crack above was just my opinion - it was not
really intended to offend any java addicts out there (the poor,
miss-guided souls).

On 11/29/05, Krystian <no****@this.home.com> wrote:
Hi
are there any future perspectives for Python to be as fast as java? i
would like to use Python as a language for writing games.

best regards
krystian
--
http://mail.python.org/mailman/listinfo/python-list

--
James Tanis
jt****@pycoder.org
http://pycoder.org
Jan 7 '06 #53
James Tanis wrote:
Quite honestly I've never heard of java being faster than.. well..
anything. Faster than Python? I really doubt it. Their are several
libraries for game programming specifically as well as opengl, sdl, as
well as several different audio systems/daemons.. I'd suggest browsing
through the categories in python.org's module search engine.

Disclaimer (:P): The majority of generalizations have some amount of
exceptions, the java crack above was just my opinion - it was not
really intended to offend any java addicts out there (the poor,
miss-guided souls).


While java is much slower than Python in developer-time (e.g. the time
it takes to generate a working app, and the number of lines involved),
(good) Java code running on the hotspot (JIT) VM is usually at least an
order of magnitude faster than the equivalent Python code, if not faster.

What's dog slow in Java is primarily the VM startup, and then the memory
bloating, but as far as execution speed goes, pure Java code is much
faster than pure Python much more often than the opposite (now that may
change with Pypy, but Pypy is not done yet)

Xavier
Jan 7 '06 #54

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

58
by: Svein Ove Aas | last post by:
Is anyone working on a python-to-native compiler? I'd be interested in taking a look. Come to think of it, is anyone working on a sexpr-enabled version of Python, or anything similar? I really...
28
by: Maboroshi | last post by:
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...
52
by: Neuruss | last post by:
It seems there are quite a few projects aimed to improve Python's speed and, therefore, eliminate its main limitation for mainstream acceptance. I just wonder what do you all think? Will Python...
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
53
by: Michael Tobis | last post by:
Someone asked me to write a brief essay regarding the value-add proposition for Python in the Fortran community. Slightly modified to remove a few climatology-related specifics, here it is. I...
1
by: abhinav | last post by:
Hi guys.I have to implement a topical crawler as a part of my project.What language should i implement C or Python?Python though has fast development cycle but my concern is speed also.I want to...
118
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely...
1
by: Jerry Fleming | last post by:
Hi, I have wrote a game with python curses. The problem is that I want to confirm before quitting, while my implementation doesn't seem to work. Anyone can help me? #!/usr/bin/python # #...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 375 open ( -3) / 3264 closed (+26) / 3639 total (+23) Bugs : 910 open ( +3) / 5851 closed (+20) / 6761 total (+23) RFE : 217 open...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.