Page 1 of 1

C++, Java (C##) and the old question of speed

Posted: Sun Jun 06, 2004 11:52 am
by buezi
In the first years java was a totally interpreted language. Therefore it used to be very slow because there was this run-time engine using large part of the cpu-time. Lots of the old "java is slow" prejudices come from this time. Nowadays java runs on a so called just-in-time compiler, this means before a statement is used it is transformed into the needed machine dependent instructions. This approach gave java a large speedup, so I guess now it would be possible to run a game with java. Especially, not every game really needs the last bit of performance.
As far as I know C++ is still faster, but I think this is only a question of time, the same arguments are valid for C##.
One argument for java (and C##) is that their object-oriented concepts are much "cleaner" than the ones in C++. With C++ you can do really nasty things, consider void pointers and the memory management as two examples. C++ gives you great freedom which means great possibilities..or great danger...

Posted: Sun Jun 06, 2004 12:01 pm
by Tyn
There's already been about 3 topics that have been jacked for this purpose, you want to start another discussion about it :D

Posted: Sun Jun 06, 2004 12:07 pm
by Guest
you are rigtht, actually I wanted to reply in one of those threads but then I was too stupid and clicked on new thread instead of reply...
......silly me :oops:

Posted: Sun Jun 06, 2004 1:02 pm
by Tyn
np, I was only joking anyway since I was the centre of most of em.

I know Java has a use and a place, but most of other peoples arguements seem to consist of "Java is great, how dare you say Java is just an offshoot of C". Fact is that Java was conceieved from C, they took the idea, used it for a very simple application and it is grown from there. It may well be faster now, it may well be closer to Assembly language now but it is still behind C++ ( from actual research I have done into the two languages, the thing even people use it have failed to do ) in the way it goes about things. From what I have found, Java is great for web applications and a few other things but it simply isn't as suitable for large scale projects such as game projects.

The only "proof" I have seen to the contray ( this includes more than this forum as well ) is someone here saying that the flying game IL2 was written partly in Java ( which I have confirmed from looking at the DLL's, not sure how much was witten in Java ). That's the game that eats system performance to do very little, the game that is slow even with all the settings down to minimum. Great endorsement! I don't mind Java, but I still think ( with a lot of others ) that it simply isn't on the same level as C++ and quite possibly will never be.

I think the arguement about C++ being really advanced but possible to really screw up are one and the same. You can take away all those dangers but by doing so you are probably going to take away the versatility of the language.

C# is interesting, however I don't know many projects are actually using them. I think if something like Q4 or HL3 will use it then other developers will be forced to learn it but until a widely used engine decided to convert I can't see it taking off. I don't really know enough about it but it seems like an easier to use version of C++, much less code to do the same things and a some additional features.

Posted: Sun Jun 06, 2004 1:29 pm
by vermeer
I don't know a single thing bout coding...but working as gfx man at company , and the meals with mates were quite clear bout it...all crys and laments for using Java and not c...or c++.While they all were java freaks.Just making something like moving huge pixels in screen, even in 2d, was WAY slower, specially in Linux...for some reason, for then (a year ago or more) the windows java thing was faster in redrawing... even so, slower than a c compiled dx game in pc...

There are of course limits limited with hardware, but basicly, they could not get very low for performance and not breaking compatibilty and dunno what more things...also for the way java works...yets so, was better for them for having all coed organzied and all, seems is extremely good for much stuff; not so good for full blown pc-like games...

There's some engines in Java, that seem doing good...Can't remember the names...

I think they use libraries, based in open gl...JOGL, and LWGL (lightweight library or something) ...soe there's this low level access library, and then game engines...basicly I was seing one as the best , dunno the name now...

but there are some. I am told it always depend if u compile for an specific machine using certain compilers (kafee?) but then u loose compatiblity and dunno what else.

eck.What the heck is a gfx person doing answering here...

Posted: Sun Jun 06, 2004 11:04 pm
by etcaptor
I don't know for C#, but in Java is security related restriction for inheritating from only one base class.
For me C++ is for now the best language.

c++ advanced features are part of the speed...

Posted: Mon Jun 07, 2004 12:37 am
by buhatkj
c++ gives the coder the ability to access anything, with a minimum of rules. Its like the code equivalent of ROOT. part of what makes it so fast is the ability to do thoroughly unwise and low-level memory things like "delete" and "memcopy" (which both to be honest, are really carry-overs from c, in fact stroustrup advises AGAINST using things like this in "the c++ programming language", and encourages coders to use OO style code as much as is possible because its is arguably cleaner and more fail-safe)
regardless of whether it is wise to use them, these things are possible in c++, and NOT possible in JAVA.

my issua with java, would moreso be about the lack of really good support for 3d avaiable. i have seen a few simple java OGL bindings, but none of them was very easy to use, most were also only partial and incomplete.

now if somebody figured out how to make a fully functional irrlicht binding for java, i might use it, but since i havent heard of one yet, i will stick ot c++ :-)
-ted

Posted: Mon Jun 07, 2004 12:48 am
by afecelis
Chrome was written in Java and it's a latest generation kind of game. Its performance is flawless and they got huge outdoor levels full of vegetation and oceans and stuff.

I'm not saying Java is better, but that there's another stream of programmers who have already gone far in 3d graphics with java.

http://www.chromethegame.com/en/index.html

Posted: Mon Jun 07, 2004 4:24 pm
by warui
Chrome wasn't written in Java. It uses it only as a scripting language.

Posted: Tue Jun 08, 2004 8:50 am
by Jedive
Didn't know C## has been released lol

Posted: Tue Jun 08, 2004 12:57 pm
by afecelis
so Chrome is C++ (+) Java?

didn't know

so what r all those java scripts for?

Posted: Tue Jun 08, 2004 2:52 pm
by Bunnz
C# is a really great language and fast enough to write great games.
Although I know that C# has still a few weak points, I'm convinced that in a few years C# will be used for many games :wink:

Have fun and greetings to Niko,
Bunnz

Visit: http://purplesharp.sourceforge.net
Purple# - a shader driven 3d engine for .NET

Posted: Tue Jun 08, 2004 3:56 pm
by warui
> so Chrome is C++ (+) Java?
> didn't know
> so what r all those java scripts for?

For scrpipting ;) It is used for such things as models information, AI procedures, mission scripting and more.