Posts: 21 | Thanked: 2 times | Joined on Aug 2007
#1
Has anyone had anh experiences with C++ vs python?

Is python any slower?
 

The Following User Says Thank You to Brenden For This Useful Post:
brendan's Avatar
Posts: 531 | Thanked: 79 times | Joined on Oct 2006 @ This side of insane, that side of genius
#2
that depends on the task to be performed. python is a high level scripting language, where as C/C++ is a low level true programming language.

with C/C++ you can get down and dirty with cpu registers and do much more along the lines of address spacing with memory allocation, or even direct communication with hardware provided you know how to talk to it.

python is an interpreted scripting language. it requires that you install libraries or an interpreter that takes the python instructions and processes it allowing the computer to understand it in a more native fashion. the libraries are often in a language like C/C++/Java.

the learning curve for python is no where near as steep as programming languages like C++ and depending on the task, it may be easier to use a scripting language. the per cycle expense of a C++ instruction and a python instruction favors the C++ side because there is no need for interpretation. but the fact that you can write something like a "hello world" app easier in python makes the trade off easier.
__________________
Nokia n800
OS 2008
Pharos iGPS 360-BT
ElmScan 5 BlueTooth
BlackBerry Bold (9000)
AT&T Wireless
 
Posts: 21 | Thanked: 2 times | Joined on Aug 2007
#3
Thx for the reply, but i know all that. What i'm curious of is overall performance...slow,slower...real slow?

Python is newer than C for me, i need a refresher in both now so now is a good time to choose the language that works best since speed is an issue on embedded devices.

Thx again
 
DataPath's Avatar
Posts: 124 | Thanked: 34 times | Joined on Mar 2007
#4
If it's a largely event-driven UI type application, then performance isn't all that much of a consideration between the languages. Most of the time is spent in the idle loop.

Otherwise, the tradeoffs depend in large part on how good a developer you are in either language.
 
Khertan's Avatar
Posts: 1,012 | Thanked: 817 times | Joined on Jul 2007 @ France
#5
Just an example : i 'm developping a small text editor with python syntax highlight and many other things in python. And there is no speed difference between mine and an other source editor writted in c.

Read this example between python/perl/c++ : http://www.strombergers.com/python/
 
Posts: 125 | Thanked: 1 time | Joined on Aug 2006
#6
where as C/C++ is a low level true programming language.
Well, times have changed I used to see them as high level PL
 
Posts: 449 | Thanked: 29 times | Joined on Jun 2006
#7
You won't notice any real speed differences for basic stuff...i don't think i'd write the next 3rd person shooter in python though.
 
Khertan's Avatar
Posts: 1,012 | Thanked: 817 times | Joined on Jul 2007 @ France
#8
i don't think i'd write the next 3rd person shooter in python though.
In fact, you can, some 3D Engine are writted as module for python ... the engine is in C/C++. So you use python for the init, loading, settup, and the c/c++ part for all things that need to be really fast
 
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#9
On a 770, the real difference between Python and C apps is in startup time (loading Python itself then the PyGTK library takes a while), but afterwards running speed is generally undistinguishable. This is probably less noticeable on the faster N800.
 
Posts: 178 | Thanked: 40 times | Joined on Aug 2007 @ UK
#10
Shamelessly pimping Squeak as another alternative :-)
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 02:16.