473,544 Members | 911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 #1
53 3380
In article <hh************ *************** *****@4ax.com>,
Krystian <no****@this.ho me.com> wrote:

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.


Why would we want Python to be as fast as Java when it's already faster?

Take a look at PyGame.
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

"Don't listen to schmucks on USENET when making legal decisions. Hire
yourself a competent schmuck." --USENET schmuck (aka Robert Kern)
Nov 30 '05 #2
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.
Why would we want Python to be as fast as Java when it's already faster?


hm... i came across this site:
http://shootout.alioth.debian.org/be...n&sort=fullcpu

could you take an attitude with regard to this benchmark?
Take a look at PyGame.


on my way :)

best
k
Nov 30 '05 #3
Krystian 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.
Why would we want Python to be as fast as Java when it's already faster?


hm... i came across this site:
http://shootout.alioth.debian.org/be...n&sort=fullcpu

could you take an attitude with regard to this benchmark?


Benchmarks are worthless. By that I mean they have no value
to me. What matters is the performance on real problems, such
as generating the 1st 6th Generation Type [1,2] Mersenne Hailstone
Collatz sequence.

That's a BIG number and needs BIG arithmetic to solve. Java has
a BigInteger module and can solve it in less than 10 minutes:

C:\Python23\use r\pyjava>java Collatz 2 177149 1

Processing time: 571690
x/2 iterations: 1531812
3x+1 iterations: 854697

The arguments evaluate to 2**177149-1. And because this is a
Mersenne number, the sequence diverges until it's over 280000 bits
before converging to 1 bit after 2386509 iterations.

But is 571 seconds a reasonable amount of time for such a difficult
problem?

Compare it to Python with the GMPY module:

C:\Python23\use r\pyjava>collat z.py 2 177149 1
r1 1531812 r2 854697 in 72.9869999886 seconds

Yes, it would appear that in this real world application Java is
ridiculously slow. Of course, Python is doing the heavy lifting
with GMPY which is a compiled C program with a Python
wrapper. But so what? Maybe the reason I use Python is
BECAUSE the math module is compiled C. Duh. With Python/GMPY
I get the high level power I need for the algorithms without
sacrificing the low level muscle I need for the heavy arithmetic.
Take a look at PyGame.


on my way :)

best
k


Nov 30 '05 #4

"Krystian" <no****@this.ho me.com> wrote in message
news:hh******** *************** *********@4ax.c om...
Hi
are there any future perspectives for Python to be as fast as java?
Sure, if/when Python becomes as water-logged with obtruse OO-layers as Java
is now.

Python is faster than Java.

Because Python per design generally is a thin layer of glue poured over
binary C modules, it does not take very many instructions before one hits
the fastest speed that the platform can go at. I would test it, then worry
about it.
i would like to use Python as a language for writing games.


From the speed requirement: Is that correspondance chess by any chance??
Nov 30 '05 #5
Frithiof Andreas Jensen wrote:

From the speed requirement: Is that correspondance chess by any chance??


Regular chess at tournament time controls requires speed too. Any pure
Python chess program would lose badly to the best C/C++ programs out
there now.

I would also like to see Half Life 2 in pure Python.

/David
Nov 30 '05 #6
>I would also like to see Half Life 2 in pure Python.

or even quake1, do you think it could have any chances to run
smoothly? or maybe demoscene productions...
Nov 30 '05 #7
Dr. Armin Rigo has some mathematical proof, that High Level Languages
like esp. Python are able to be faster than low level code like
Fortran, C or assembly.

I am not wise enough to understand that proof.

Maybe I understood those papers totally wrong and he was saying
something totally different.

But whatever, the pypy-team is formed out of some more people of his
calibre and founded by the European Union to provide "butter by the
fish", say, to produce real code that may deliver that promise.

And I could see real development just from watching the BDFL: 3 years
ago PyPy was 2000times slower then CPython, and Guido was joking "and
that number is growing", this year there were not officially negated
romours that sometime maybe PyPy could be the reference implementation
of Python; and also reports that PyPy is only 18 times slower then
CPython.

For the time being, my Python programs just sit and wait for database,
network, user input or the acting of COM-Applications like Excel or
Winword. Sometimes I even have 3 threads, one to wait for user, one for
database and one to wait for Excel - boy, I wait fast!

But on the other hand, I do no real world applications like triple
mersenne first person shooters, only business software like the one
which in earlier time was written in COBOL or carved into cave walls.
Less challenge, higher reward.

Harald

Nov 30 '05 #8
Harald Armin Massa wrote:
Dr. Armin Rigo has some mathematical proof, that High Level Languages
like esp. Python are able to be faster than low level code like
Fortran, C or assembly.


Faster than assembly? LOL... :)
/David
Nov 30 '05 #9
David Rasmussen wrote:
Harald Armin Massa wrote:
Dr. Armin Rigo has some mathematical proof, that High Level Languages
like esp. Python are able to be faster than low level code like
Fortran, C or assembly.


Faster than assembly? LOL... :)


I think the claim goes something along the lines of "assembly is so hard
to get right that if you can automatically generate it from a HLL, not
only will it be more likely to be correct, it will be more likely to be
fast because the code generator can provide the appropriate optimizations".

OTOH, you can almost certainly take automatically generated assembly
code and make optimizations the code generator wasn't able to, thanks to
knowing more about the real semantics of the program.

STeVe
Nov 30 '05 #10

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

Similar topics

58
3945
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 miss my macros whenever I try to use it...
28
2565
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 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...
52
3798
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 (and dynamic languages in general) be someday close to compiled languages speed? What will be the future of Psyco, Pypy, Starkiller, Ironpython and...
31
4726
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 great for pattern matching, text processing, and automated testing. Our company is really fixated on risk managnemt and the only way I can do enough...
53
4296
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 would welcome comments and corrections, and would be happy to contribute some version of this to the Python website if it is of interest. ===
1
3343
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 strke a balance between development speed and crawler speed.Since Python is an interpreted language it is rather slow.The crawler which will be...
118
6590
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 hated it, having learned C++ a few years prior. They didn't teach Lisp at all and instead expected us to learn on our own. I wasn't aware I had to...
1
3681
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 # # Brick & Ball in Python # by Jerry Fleming <jerryfleming@etang.com>
0
337
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 ( -1) / 220 closed ( +3) / 437 total ( +2) New / Reopened Patches ______________________
0
7429
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7368
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7614
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7384
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
4922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3420
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3414
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1844
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
990
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.