PDA

View Full Version : C++ compared to Java



ElastoManiac
12-17-2006, 03:58 AM
How faster is C++ compared to Java ? I tryed asking this at offical java forum but they deleted my thread...

Tonto
12-17-2006, 04:44 AM
Do you realize that what you are saying is inflammitory?

http://72.14.203.104/search?q=cache:fnOW5wBw_qwJ:www.kano.net/javabench/+javabench&hl=en&gl=us&ct=clnk&cd=1
http://www.kano.net/javabench/

laserlight
12-17-2006, 05:06 AM
Probably marginally faster, considering C++ has 3 characters compared to 4 characters for Java.

Salem
12-17-2006, 05:34 AM
> How faster is C++ compared to Java ?
http://www.albionmich.com/inspiration/shallicompare.html

How about just picking the right tool for the job?

Your question is about as meaningful as which is better, a hammer or a screw-driver.

Why do you keep asking?
http://cboard.cprogramming.com/showthread.php?t=77811

dac
12-17-2006, 11:36 AM
the university im planning on going to next summer only teaches Java. unfortunately.

Lateralus
12-17-2006, 10:54 PM
For what kind of degree? Only Java?

At my university, Java is taught first, then C++; from there its the students job to learn other languages (besides obvious cases).

The point is: a programming language is a tool, nothing more. You simply need to decide which tool best suits the problem at hand(Java, C++, Python....whatever)

swgh
12-18-2006, 03:48 AM
The speed that a language works is not that important, apart from perhaps game code, where as well written C++ programs can be lightning quick

indigo0086
12-18-2006, 08:22 AM
One thing I find wierd is that in my computer science course they start with java, then end up doing all the top tier classes in C++ (with the exception of programming languages which teaches several)

cboard_member
12-18-2006, 08:32 AM
I vote to lock or delete this thread. The original question was asinine and now it's totally derailed.

swgh
12-18-2006, 09:14 AM
One thing I find wierd is that in my computer science course they start with java, then end up doing all the top tier classes in C++ (with the exception of programming languages which teaches several)

It maybe that learning Java would give you a solid foundation for moving on to unserstanding C++. Personally, I had no interst in Java. I am not knocking it, it is a good language with many uses, but C/C++ was more what I needed. When I left school in 1997, I learnt a small C course but then took to learning C++ in my own time.

Mario F.
12-18-2006, 11:01 AM
> but they deleted my thread...

There's 4 religions out there.
- One considers any question like this inflammatory. Followers of this religion usually are secret believers of one of the next two religions.

- Two other religions have an answer to that question. And they stick to it!

- The forth and last religion know there is no answer. Atheists! But damn me if they aren't the smart ones.

Salem
12-18-2006, 11:41 AM
The better question would be "I have the following requirements for foo, what might the pros and cons of a Java or C++ implementation be?".

> I vote to lock or delete this thread.
We'll see what ElastoManiac's first rebuttal to the arguments are....

Jaqui
12-19-2006, 01:29 PM
>
- Two other religions have an answer to that question. And they stick to it!


ok, I'll openly admit I'm in one of these two religions :D

in all seriousness, Java is slower in execution for a number of reasons, not the least of which is the jvm.

add that you have to build the framework for your object, every time you want to use it, in java and you have bloated code to start with.
[ essentially, java requires scaffolding around every object in the code to support the code from falling over itself ]

a program in C++ can be badly written, with tons of bloat and perform slowly as well, but C++ does not require such bloat as java does.


the jvm issue isn't that it's needed, it's that there is more than one.
sorry, eclipse framework to support multiple jvms is just more bloat in the language, not a smart choice.
it's a cop-out, and the eclipse team should all be shot for stupidity.

swgh
12-19-2006, 01:57 PM
hence the reason why many beginner programmers would choose C++ over Java. Especially for games ( being that was their ideal aim )

CornedBee
12-19-2006, 07:04 PM
the jvm issue isn't that it's needed, it's that there is more than one.
sorry, eclipse framework to support multiple jvms is just more bloat in the language, not a smart choice.
it's a cop-out, and the eclipse team should all be shot for stupidity.
Now that paragraph didn't really make sense. What has Eclipse to do with the language?

Perspective
12-20-2006, 09:12 AM
the jvm issue isn't that it's needed, it's that there is more than one.
sorry, eclipse framework to support multiple jvms is just more bloat in the language, not a smart choice.
it's a cop-out, and the eclipse team should all be shot for stupidity.


huh? Do you mean more than one JVM instance, or more than one vendor? If you mean more than one vendor than yes, that is a problem. No 2 JVMs are the same. If you mean more than one instance, than you don't understand how Java works :p

Eclipse doesn't have a "framework to support multiple jvms" afaik, and it definately isn't part of the language. Don't drag eclipse into this, it's a great piece of software, many developers (Java and C++ alike) could learn a lot from it's design. Your ignorance just demonstrates your lack of understanding.

Jaqui
12-21-2006, 12:01 AM
nope, eclipse is a java based tool to develop in java.
it's primary benefit being support for multiple different jvms.
the c++ tools in eclipse are all written in java.
and every time I take distro supplied eclipse installers and install eclipse, it fails.
[ gee, like microsoft office not installing on windows, not impressive for the application or company ]
yup, every distro I have looked at I have tested the eclipse install, they have all failed to install a working version of it.
[ yet another proof java is broken beyond usability, the "end all and be all" dev tool doesn't install.

Wraithan
12-21-2006, 12:53 AM
Hmm that is odd, I have never had any problems installing Eclipse, I had a couple problems with a couple plug-ins for it, but I found out that it was my fault and not the plug-in's fault. I typically don't use distro-provided software other than the base operating system and sometimes the drivers.

CornedBee
12-21-2006, 07:17 AM
Eclipse is a Java-based application infrastructure. The Eclipse Platform is a generic development environment.

The Java Development Tools are the Java IDE, just like the C Development Tools are the C/C++ IDE.

By distro-supplied Eclipse installers, do you mean Linux distros? So how is that Eclipse's fault? Eclipse's own installer works flawlessly. The program's main issue is that if it's installed to a cross-user directory, it takes an admin to install or upgrade plugins, which is the actual reason I don't use Gentoo's Eclipse ebuild (which otherwise worked flawlessly, I might add).

And Eclipse's primary benefit is not supporting many JVMs. I still don't even know what you mean by that. Being installable in different versions? Others can do that. Compiling for multiple versions? Others can do that, too. Compiling for VMs by different vendors? Actually, JVM differences manifest themselves in different runtime characteristics; other than that, all programs run the same unless they use some vendor-specific functionality (such as com.sun.* or sun.* classes).

Eclipse's primary benefit is its excellent design and thus the many great plugins available for it, including the extremely good Java editor, code refactorer, source completer, etc.

And all of this has nothing to do with Java, so stop your pointless ranting.

indigo0086
12-21-2006, 07:40 AM
What exactly is a code refractorer. The most I've used it is to rename classes and it changes all references throughout the code to the class. Is there more to refractoring?

CornedBee
12-21-2006, 08:35 AM
It can move methods through the hierarchy, classes to other packages, rename methods, variables, extract string literals into constants or resource files, all that stuff. And it can do it without introducing errors in your code, which is more than can be said about most manual refactoring.

Mario F.
12-21-2006, 08:58 AM
> Is there more to refractoring?

A lot more. Ultimately refactoring is about changing your code without affecting its behavior. It's not about changing your code to fix bugs or alter its behavior.

At the simplest level it can be about changing one variable name to something more readable or understandable, and at the most complex level changing your whole hierarchy structure. You refactor all the time when writing code without a strict specification behind. However, the key point behind this abstract concept is that you only do it when you don't alter your application behavior.

EDIT: I would probably add that not altering your application behavior, but improving its performance is not what refactoring is about either.

Perspective
12-21-2006, 11:03 AM
nope, eclipse is a java based tool to develop in java.
it's primary benefit being support for multiple different jvms.
the c++ tools in eclipse are all written in java.
and every time I take distro supplied eclipse installers and install eclipse, it fails.
[ gee, like microsoft office not installing on windows, not impressive for the application or company ]
yup, every distro I have looked at I have tested the eclipse install, they have all failed to install a working version of it.
[ yet another proof java is broken beyond usability, the "end all and be all" dev tool doesn't install.

PEBKAC

Perspective
12-21-2006, 11:06 AM
>if it's installed to a cross-user directory, it takes an admin to install or upgrade plugins,

Actually you can install plug-ins into user defined directorys, independant of the eclipse install location. You just select "Add local site" or something during the install wizard.


+1 on eclipse's refactoring tools. Absolutely superb.

CornedBee
12-21-2006, 03:28 PM
Actually you can install plug-ins into user defined directorys, independant of the eclipse install location. You just select "Add local site" or something during the install wizard.
Yes, but my installation wanted to register them in some file that lies in the main installation directory. And as a normal user I don't have write access to that file.

Perspective
12-21-2006, 06:35 PM
Yes, but my installation wanted to register them in some file that lies in the main installation directory. And as a normal user I don't have write access to that file.

hmm, thats odd. I've never had that problem with the Fedora distro,

CornedBee
12-21-2006, 06:54 PM
Well, if I remember correctly, I got that ebuild from an experimental overlay, so that may have been it.

Rashakil Fol
12-23-2006, 02:38 PM
How faster is C++ compared to Java ? I tryed asking this at offical java forum but they deleted my thread...

Why do you even care? Are you actually having trouble with Java being too slow?

twomers
12-23-2006, 02:50 PM
Why do you even care? Are you actually having trouble with Java being too slow?

You never curious about things?

Dante Shamest
12-24-2006, 12:02 AM
Disclaimer: I've programmed in both C++ and Java for quite a few years. In fact, I code J2EE applications for a living now.

In my experience, for speed, C++ is definitely the winner here. Java is written in C++, so theoretically it can't be faster than C++. Plus, Java adds a lot of baggage like runtime array bounds-checking, instead of compile-time assert() checking, runtime generics instead of compile-time templates, etc.

BUT HOLD ON! It can be faster than other less well-written C++ apps.

Java is noticeably slow on Windows PCs during startup, and for Swing GUIs and applets.

BUT HOLD ON! On Linux, Swing seems to perform much less poorly, and by using the non-standard SWT over Swing, desktop apps seem to improve remarkably in speed and native look-and-feel.

CodeMonkey
01-09-2007, 10:35 PM
The College Board's Advanced Placement curriculum for computer science (highschool) recently switched from using C++ to using Java. I don't know whether that's because it is a more ideal language to teach (as I would imagine), or because someone thought that Java might outlive C++. Total derailment -- just thought I'd chime in.

VirtualAce
01-09-2007, 11:57 PM
Die thread die!!!

Salem
01-10-2007, 06:46 AM
<gunshot> and the thread lies motionless.