maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   C++ vs python (https://talk.maemo.org/showthread.php?t=9159)

Brenden 2007-08-25 00:46

C++ vs python
 
Has anyone had anh experiences with C++ vs python?

Is python any slower?

brendan 2007-08-25 00:55

Re: C++ vs python
 
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.

Brenden 2007-08-25 02:26

Re: C++ vs python
 
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 2007-08-25 04:50

Re: C++ vs python
 
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 2007-08-25 06:17

Re: C++ vs python
 
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/

Luna 2007-08-30 01:50

Re: C++ vs python
 
Quote:

where as C/C++ is a low level true programming language.
Well, times have changed :) I used to see them as high level PL

bac522 2007-08-30 02:01

Re: C++ vs python
 
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 2007-08-30 07:37

Re: C++ vs python
 
Quote:

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 2007-08-30 07:58

Re: C++ vs python
 
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.

muki 2007-08-30 17:05

Re: C++ vs python
 
Shamelessly pimping Squeak as another alternative :-)


All times are GMT. The time now is 19:46.

vBulletin® Version 3.8.8