The Artima Developer Community
Sponsored Link

Python Answers Forum
Speed of Python

3 replies on 1 page. Most recent reply: Dec 11, 2008 8:46 AM by Alpha Dog

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Peter P

Posts: 1
Nickname: wond3r
Registered: Jun, 2007

Speed of Python Posted: Jun 23, 2007 8:52 AM
Reply to this message Reply
Advertisement
I have a idea of creating 3D game(Diablo clone but in 3D) in python-ogre3d engine. It is a python modification of ogre3d engine (www.ogre3d.org). I'm curious if is able to create whole game in python, because i heard that python code runs in some cases 700x slower than C code and tha'ts a realy problem for game. Sure the game will not have next-gen graphics ... it's project about 3 people working on it :). I'm quite skilled(2years programming in job) in C++ but i think the creation of game is hard enought to programm itself so i want to use high language as Python to speed-up development progress. I make familiar with pros of Python but con of low speed is here significant. Can you tell me truth about speed python because i can't find serious answer and i can't make my decision starting programing game.


ian o

Posts: 8
Nickname: iano
Registered: Aug, 2007

Re: Speed of Python Posted: Aug 19, 2007 3:53 AM
Reply to this message Reply
You would need some really special code to see that 700x.

Writing object oriented code in c++ vs inline, c code the works to avoid function call can acutally produce a speed penalty of that order too- but only in extreme and a typical situations.

Fetching each byte of python code and deciding what to do has a performance hit- but how much happens as result will determine how significant the hit. Do a bit shift, which is a very small amount of computer work, and the overhead of python instruction is extreme. Anything which calls the operating or libraries (e.g. graphics manipulation) and the overhead become insignificant.

The heavier the graphics, the less significant the performance penalty. From the sound of it in an application like yours the performance penalty would be less than 20% (1.2) rather than 700x or (70000%). Once the game is working you can at any time transfer any code from python to a c library to target any performance critical code which is evaluated to have a real impact. The end result is you get the game working earlier, and by moving anything that turns out to be performance critical into a binary library (which in all likelyhood is already the case through your graphic libs) you will not notice any performance change in the end.

Alpha Dog

Posts: 7
Nickname: alphadog
Registered: Dec, 2008

Re: Speed of Python Posted: Dec 11, 2008 8:39 AM
Reply to this message Reply
There are game engines developed partly or fully in Python, most notably Panda3d (used by Disney) and PySoy.

EVE Online uses stackless.

I think you should be fine.

Alpha Dog

Posts: 7
Nickname: alphadog
Registered: Dec, 2008

Re: Speed of Python Posted: Dec 11, 2008 8:46 AM
Reply to this message Reply
I'll add that, to avoid any issues, your best bet is to find a Python layer over an established 3D rendering engine, not necessarily for performance reasons, but rather because if you want to build a game, don't waste time on building a game engine...

Flat View: This topic has 3 replies on 1 page
Topic: Data Entry Using Python Previous Topic   Next Topic Topic: low child in xml

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use