speeds of programming languages.

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
Post Reply
xsx
Kobold
Posts: 31
Joined: Tue Jan 20, 2009 10:38 am
Location: egypt

speeds of programming languages.

Post by xsx »

I read that people saying something about difference in speed between C++ and Python.

Is this theory right ?

Is there any difference in speed , efficiency or anything in performance between programs written with different languages ?

What i like about Ogre 3D is that it uses C++ as a primary language.

But i still want to know about this theory , is it real ?
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Re: speeds of programming languages.

Post by reptor »

What theory? :)

Of course there is difference.

Of those two Python is the slower one.


Here is a website which might help to estimate which language is fast and which is not:

http://shootout.alioth.debian.org/


But it depends what you want to do with the language whether it is fast-enough or not. The development speed is also important, and with the slower languages you might get better development speed than with the faster ones.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: speeds of programming languages.

Post by Kojack »

The difference between languages isn't theoretical, it can be massive.
Depending on the task and the language, one can be hundreds of times faster than another.

There can also be vast differences in the memory usage of different languages.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: speeds of programming languages.

Post by jacmoe »

Dynamically or strongly typed, compiled or interpreted.
Those factors contributes a lot to the relative speediness of languages.

Python-Ogre is an excellent example of using the best features from each group: the speediness of C++ and the flexibility of Python.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: speeds of programming languages.

Post by xadhoom »

My Prof always preached that a language without type safety is not a programming language, maybe at most a scripting language...

xad
bharling
Gremlin
Posts: 166
Joined: Fri Jun 30, 2006 1:04 pm

Re: speeds of programming languages.

Post by bharling »

I use python pretty much exclusively ( mainly because I'm not good at writing C++ ).

On the plus side, its really very quick to sketch out ideas without having to worry about making everything work the way the system requires. And in some rare cases it can actually be faster than C++, as python allows you to do clever things more easily. I've written things like octrees in python that seem to run faster than the equivalent c++.

The downside is of course that its still interpreted, so there will always be extra overhead as python calls underlying functions from your code, sometimes this overhead can be huge, but in day-to-day use you're unlikely to encounter it too much. Ogre really could not be written in python, but python provides an almost perfect way to control Ogre at a higher level.

I've used python in a lot of commercial projects in my job, and have rarely encountered something that just can't be done, mainly due to the extensive support libraries python provides. I'm also using Python-Ogre currently for prototyping a major project, though the eventual implementation will be C++ based ( and handled by someone with considerably more skill than me, i hope ;) )
Was here
User avatar
Evak
Orc Shaman
Posts: 707
Joined: Sun Apr 02, 2006 7:51 pm
Location: Sacramento, CA
x 1
Contact:

Re: speeds of programming languages.

Post by Evak »

Were using blitzmax with ogre in Flow, Bmax being a kind of OO basic/C hybrid . It compiles to C++ and seems pretty fast. Averaged about 2-4% slower than straight c++ in the comparison tests that were done a while back.
User avatar
JohnJ
OGRE Expert User
OGRE Expert User
Posts: 975
Joined: Thu Aug 04, 2005 4:14 am
Location: Santa Clara, California
x 4

Re: speeds of programming languages.

Post by JohnJ »

Evak wrote:Were using blitzmax with ogre in Flow, Bmax being a kind of OO basic/C hybrid . It compiles to C++ and seems pretty fast. Averaged about 2-4% slower than straight c++ in the comparison tests that were done a while back.
I've seen you say this a few times, and it confuses me a little about what you mean by "BlitzMax compiles to C++". IIRC, Mark Sibley said that BlitzMax compiles to an assembly language / opcode. Maybe I'm misinterpreting this, but it sounds like you're saying BlitzMax converts the syntax to C++, which it then uses a C++ compiler to compile into an executable. I know that BlitzMax allows you to download and integrate MingW, which you can use to integrate C++ libraries, but I'm 99% sure that BlitzMax is a real compiler and doesn't just "translate" to C++ (otherwise why would it lack so many features C++ has?)
User avatar
Evak
Orc Shaman
Posts: 707
Joined: Sun Apr 02, 2006 7:51 pm
Location: Sacramento, CA
x 1
Contact:

Re: speeds of programming languages.

Post by Evak »

JohnJ, Don't know to be honest. When I described it before on the flow showcase threads I was just trying to explain it in laymans terms for those that didn't know what it was. From what our C++ coder could glean from it, Bmax seems to be a kind of C wrapper with easy to use helper functions compiled with GCC. Whether it uses its own compiler I don't know.
Last edited by Evak on Mon Jan 26, 2009 8:15 pm, edited 1 time in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: speeds of programming languages.

Post by jacmoe »

Blitxmax is a compiler, made in C/C++. So, yes: it's C++, but not quite. Because the BM compiler compiles to byte-code (AFAIK). Sort of like the CLR in .NET. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply